-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set dark mode as default #43
Comments
Good question! You could set all the CSS as dark by default, and have the switch 'on' by default. If a user swicthes to 'off' you could load a light-mode CSS instead. It should be quite straight forward, though I may add a separate demo for that at some point. |
Alright, thanks! |
I think just add the |
I think to add the data-theme attribute would not be enough. truly the CSS would show the page with dark style, but the switch would appear off. The initTheme-method needs then to be extended to check if the attribute is already set. Currently only localStorage is checked. But I don´t know yet, if this would be the best solution. |
but there is a problem with the toggle if we make it like that |
Yes, the switch button will not updated. I created custom script to handle it. See my changes: ardianta@9fad4b9?branch=9fad4b93e68d588559cfc898c0411b6665e063aa&diff=split |
thanks mas |
As the title says.
The text was updated successfully, but these errors were encountered: