Detect dark theme in Blade

How do I detect if dark theme is enabled in a Blade template, so I can display a different version of an image? I'm overriding Filament's logo.blade.php to show the client's logo top left, but need to display different versions depending on dark or light theme.
Solution:
Oooooh! You mean like do it how it tells me to in the documentation? Derp. sigh...
Filament
Appearance - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
Jump to solution
6 Replies
awcodes
awcodes2y ago
You could make it an alpine component and read it from the alpine store or from local storage.
cheesegrits
cheesegritsOP2y ago
I could what now? Eli5? I was hoping there was a pseudo selector for classes like dark:hidden and dark:visible, but that doesn't seem to work.
Solution
cheesegrits
cheesegrits2y ago
Oooooh! You mean like do it how it tells me to in the documentation? Derp. sigh https://filamentphp.com/docs/2.x/admin/appearance#dark-mode
Filament
Appearance - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
LeandroFerreira
on v3 it is @theme-changed.window="..." you can get the current mode with this document.querySelector('html').matches('.dark') ? 'dark' : 'light'
cheesegrits
cheesegritsOP2y ago
Thankyou!
Aurko
Aurko16mo ago
how can I get the trigger of the filament's dark-light toggle button? Anyone?

Did you find this page helpful?