conditionally set dark mode

is it possible to set dark mode based on certain config? I want to disable the theme mode switcher and set the dark mode based on a setting from laravel settings, but I can't figure out how to do it (as the darkMode method do not accept closure)
Solution:
I think you can use something like this to handle it ```php if ($xx) { filament()->getPanel('xx')->darkMode(true);...
Jump to solution
3 Replies
Bruno Silva
Bruno SilvaOP3mo ago
I've tried RenderHooks to add a JS script and inject the class "dark", but it gets cleared after the page loads anyone?
LeandroFerreira
LeandroFerreira3mo ago
maybe a middleware?
Solution
LeandroFerreira
LeandroFerreira3mo ago
I think you can use something like this to handle it
if ($xx) {
filament()->getPanel('xx')->darkMode(true);
}
if ($xx) {
filament()->getPanel('xx')->darkMode(true);
}
Want results from more Discord servers?
Add your server