Badge component color using hex
Hello, I am using the
Badge Filament Blade component
, and I would like to change its color by passing a hex code, but it is not working.
I tried using the TextColumn
badge functionality to change the color with a hex code, and it worked like this:
Color::hex($record->attributeOptions->first()->color_code);
However, when I try to achieve the same with the Blade component, it doesn't work.
Can anyone help me with this?5 Replies
https://filamentphp.com/docs/3.x/support/blade-components/badge#changing-the-color-of-the-badge
If you want to use a custom color I think you need to use a custom theme.
Okay, but the colors are unpredictable because they are picked using the color picker on another part of the app.
What about https://filamentphp.com/docs/3.x/support/colors#generating-a-custom-color-from-a-hex-code
and then use it in the blade component?
the problem is the color attribute expect string and the
Color::hex($record->attributeOptions->first()->color_code);
make an array