© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
11 replies
PabloZagni

badge color from color field

Hi. My APP has a "priority" model with a name and a 'color' field.
My "ticket" model belongsTo a priority, so I need to show the badge in the corresponding color.
Any example? Thanks
image.png
Solution
When you have a hexadecimal value you can use: Color::hex();

https://filamentphp.com/docs/3.x/support/colors#generating-a-custom-color-from-a-hex-code

To help you to the end result:
>color(fn ($record) => Color::hex($record->priority->color))
>color(fn ($record) => Color::hex($record->priority->color))
Colors - Core Concepts - Filament
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Badge Color From Relationship
FilamentFFilament / ❓┊help
3y ago
How to set badge color from relation
FilamentFFilament / ❓┊help
3y ago
Color For multiple badge
FilamentFFilament / ❓┊help
8mo ago