Force Light / Dark Mode #3979
-
Is there an option to remove the picker and force one or the other? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Would be great to have this feature. Even if we hide the Switcher we should be able to force mode instead of using the system one. |
Beta Was this translation helpful? Give feedback.
-
// resources/js/nova.js
// force light mode
localStorage.novaTheme = 'light'
document.documentElement.classList.remove('dark')
// force dark mode
localStorage.novaTheme = 'dark'
document.documentElement.classList.add('dark') Then add the following to /**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
parent::boot();
Nova::withoutThemeSwitcher();
Nova::script('nova-custom', resource_path('js/nova.js'));
} |
Beta Was this translation helpful? Give feedback.
-
Thank you for your suggestion @crynobone but i think its still just a workaround - it should be added to the nova options or as a parameter to Nova::withoutThemeSwitcher(); |
Beta Was this translation helpful? Give feedback.
Then add the following to
app\Providers\NovaServiceProvider.php