Xiaohou
Explore posts from serversHow to refer to filament semantic color in blade file?
I looked into the filament button blade file, it seems to use CSS variables to display to colors. You can get the variable by color use support method from filament.
it will give you the custom css variables, something like this
--c-50:var(--primary-50);--c-400:var(--primary-400);--c-600:var(--primary-600);
once you have the css variables by color, just apply the variables to html element, then you can use it by refering it as custom
Now if the primary
color changes in filament, it will reflect in our custom component as well. I'm sure if this is the best way to use the color registered by filament, but I hope it can help anyone who has the same problem.8 replies
How to refer to filament semantic color in blade file?
Thanks for helping me out, but I'm not sure if I understand correctly. I'm happy with the current colors, i don't need a custom theme to replace the default ones.
I just need to render elements with the current registered color in filament. For example. i want to make a div with the 'warning' color filament has registered. without having to refer it as tailwind color. So when I change the filament register color from
warning' => Color::Amber
to warning => Color::Orange
, my component color would update alone with filament.8 replies