FilamentF
Filament3y ago
4 replies
Jon Mason

Color problems - dynamic classes and custom palettes

I'm doing this:

     FilamentColor::register([
            'primary' => Color::hex('#FA4800'),
            'danger' => Color::hex('#FA4800'),
            'gray' => Color::Zinc,
            'info' => Color::Blue,
            'navy' => Color::hex('#0B1F38'),
            'secondary' => Color::hex('#269BDB'),
            'success' => Color::Green,
            'warning' => Color::Amber,
            'sky' => Color::Sky,
            'mwBlue' =>  Color::hex("#269BDB"),
            'mwOrange' => Color::hex("#FA4800"),
            'mwNavy' => Color::hex("#327CD7"),
        ]);

In my AppServiceProvider. Some colors don't seem to work. For example, "sky" in general doesn't work, but also green-400 doesn't work, but green-500 does. I'm storing the classes in the database and echoing them out when the page renders, which I recall reading causes problems with tailwind since it doesn't see the classes when compiling. I can't seem to remember how to get around the problem though.

ALSO - in other cases, like "mwNavy", I tried using that by just hard-coding the class and it doesn't work either. Do I have to add these to tailwind in addition to using FilamentColor::register()?
Solution
Configuring the content sources for your project.
Content Configuration - Tailwind CSS
Was this page helpful?