You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I try to run in the console from your website (https://jonathanwoollett-light.github.io/cv/) document.documentElement.setAttribute('theme', 'dark');
then the theme is switching in dark mode.
If I run document.documentElement.removeAttribute('theme'); then the theme is switching back in light mode.
It seems to not work when my device theme is darkmode but does work when in lightmode.
I think the example assumes the device theme is lightmode so that when document.documentElement.removeAttribute('theme'); is run it switches to darkmode.
But when the device theme is darkmode when you run document.documentElement.removeAttribute('theme'); the site will remain dark.
A fix would be changing document.documentElement.removeAttribute('theme'); to document.documentElement.setAttribute('theme','light');, possibly in the future it could be extended with a 3rd state that passthroughs the theme.
Before submitting...
Context
I recently attempted to add a theme switch to my webpage (JonathanWoollett-Light/cv@1e93235). I copied the code from https://materializeweb.com/themes.html and the element from the page.
It functions like the theme switch on https://materializeweb.com/themes.html except that the page theme doesn't change.
Current Behavior
The icon changes and the correct case occurs but the theme isn't changed.
Expected behavior
The page theme should be flipped between light and dark.
Possible Solutions or Causes
No response
Steps to reproduce
Open https://github.com/JonathanWoollett-Light/cv/blob/1e9323509877f1644fdba3fa83cc6bc0bf39282d/index.html in a webbrowser and click the theme switch icon.
It looks like:
Your Environment
The text was updated successfully, but these errors were encountered: