Is there a way to remove the theme switcher and just have dark mode?

My users are extremely limited and my client is picky. They do not want the light mode feature. Can we just serve a single theme, dark mode, and remove the switcher??? Thanks.
9 Replies
Lara Zeus
Lara Zeus2mo ago
this will force dark mode: https://filamentphp.com/docs/3.x/panels/themes#changing-the-default-theme-mode but not sure about removing the switcher form the menu
justhammin
justhamminOP2mo ago
I"ve tried that, but when I switched my mac's color theme to light, it switched Filament to light as well.
justhammin
justhamminOP2mo ago
No description
No description
Bruno Pereira
Bruno Pereira2mo ago
public function darkMode(bool $condition = true, bool $isForced = false): static
{
$this->hasDarkMode = $condition;
$this->hasDarkModeForced = $isForced;
public function darkMode(bool $condition = true, bool $isForced = false): static
{
$this->hasDarkMode = $condition;
$this->hasDarkModeForced = $isForced;
Second param is to force darkmode, so darkmode(true,true)
Lara Zeus
Lara Zeus2mo ago
its working with ->defaultThemeMode(ThemeMode::Dark) you amy need to clear the storage data?
Bruno Pereira
Bruno Pereira2mo ago
if you force darkmode, the theme switcher will not show, according to the view in the repo
justhammin
justhamminOP2mo ago
It works on my main install as well, but I think it's because I had dark mode selected manually. In another browser, with another user I had it loaded and it was switching regardless of that setting. Thanks so much for following up though!
Bruno Pereira
Bruno Pereira2mo ago
@if (filament()->hasDarkMode() && (! filament()->hasDarkModeForced()))
<x-filament::dropdown.list>
<x-filament-panels::theme-switcher />
</x-filament::dropdown.list>
@endif
@if (filament()->hasDarkMode() && (! filament()->hasDarkModeForced()))
<x-filament::dropdown.list>
<x-filament-panels::theme-switcher />
</x-filament::dropdown.list>
@endif
justhammin
justhamminOP2mo ago
This worked for me. Using ->darkMode(true, true) caused my browsers to force dark mode AND it removed the theme switcher from the top. Thank you!

Did you find this page helpful?