F
Filament5mo ago
wazkaz

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?
7 Replies
wazkaz
wazkazOP5mo ago
Okay, but the colors are unpredictable because they are picked using the color picker on another part of the app.
wazkaz
wazkazOP5mo ago
the problem is the color attribute expect string and the Color::hex($record->attributeOptions->first()->color_code); make an array
ChandraAT
ChandraAT2mo ago
@wazkaz did you solvethis? I run into same problem rn
Dennis Koch
Dennis Koch2mo ago
You know, you can just pick an array item? Or pass the color without the Color method?

Did you find this page helpful?