FilamentColor::register() not working properly

Hello everyone, I'm trying to override the default colors in my AppServiceProvider boot function, like so
FilamentColor::register([
'danger' => Color::Red,
'gray' => Color::Zinc,
'info' => Color::Blue,
'primary' => Color::Amber,
'success' => Color::Green,
'warning' => Color::Amber,
]);
FilamentColor::register([
'danger' => Color::Red,
'gray' => Color::Zinc,
'info' => Color::Blue,
'primary' => Color::Amber,
'success' => Color::Green,
'warning' => Color::Amber,
]);
And when I use a class like bg-primary-500 it works but if I use any other color it doesn't. Anyone has this problem too? P.S. When I change the color of 'primary' the application detects that change. Laravel: 10.10 Filament: 3.2.* PHP: 8.2 Thanks
Solution:
Ok, after looking at the source code I was able to use the classes with: ``` ->extraInputAttributes([ 'class' => 'bg-custom-50 dark:bg-custom-400/10',...
Jump to solution
3 Replies
LeandroFerreira
LeandroFerreira10mo ago
I guess if you want to apply Tailwind CSS classes that are not already used in Filament, you should do this https://filamentphp.com/docs/3.x/panels/themes#creating-a-custom-theme and update your content configuration in tailwind.config.js to also scan for classes inside your directory: ./app/Filament/**/*.php
Bruno Pereira
Bruno PereiraOP10mo ago
Hey thanks for the reply but I'm using the default colors of filament, they already exist. For example if I'm sending a notification of type success the color will be green but in the register method I say that 'success' is Color::Amber it doesn't work
Solution
Bruno Pereira
Bruno Pereira10mo ago
Ok, after looking at the source code I was able to use the classes with:
->extraInputAttributes([
'class' => 'bg-custom-50 dark:bg-custom-400/10',
'style' => \Filament\Support\get_color_css_variables(
'success',
shades: [50, 400, 600],
),
])
->extraInputAttributes([
'class' => 'bg-custom-50 dark:bg-custom-400/10',
'style' => \Filament\Support\get_color_css_variables(
'success',
shades: [50, 400, 600],
),
])
Want results from more Discord servers?
Add your server