colors

#❓┊help How can i take the colors for a panel based on the logged in user
2 Replies
Patrick Boivin
Patrick Boivin17mo ago
I think you can do this in a service provider (e.g. AppServiceProvider):
public function boot(): void
{
Filament::serving(function () {
$color = auth()->user()->getColor(); // e.g. 'Blue'

FilamentColor::register(['primary' => constant('\Filament\Support\Colors\Color::' . $color)]);
});
}
public function boot(): void
{
Filament::serving(function () {
$color = auth()->user()->getColor(); // e.g. 'Blue'

FilamentColor::register(['primary' => constant('\Filament\Support\Colors\Color::' . $color)]);
});
}
awcodes
awcodes17mo ago
Or if it's a hex color stored in the DB.
FilamentColor::register([
'primary' => Color::hex($color)
])
FilamentColor::register([
'primary' => Color::hex($color)
])
Want results from more Discord servers?
Add your server