-
Notifications
You must be signed in to change notification settings - Fork 70
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
Flashes when system prefers dark, but light theme is toggled #25
Comments
Thanks for opening the issue. The problem you're describing was already discussed before, I have provided an answer in #20 (comment). Hope this helps. I'm closing the issue, but feel free to comment again. Cheers! |
Ah thanks, I searched for the wrong words 👍 You said:
It seems to me like the toggle code doesn't run until |
You could preload the module: <link rel="modulepreload" src="https://unpkg.com/dark-mode-toggle" crossorigin> |
Hmm, looks like that's still experimental https://caniuse.com/#feat=link-rel-modulepreload |
It is experimental. But where it works, it helps. And where it doesn't work, it doesn't cause harm. |
This even happens on the demo site. https://googlechromelabs.github.io/dark-mode-toggle/demo/index.html
Tested on both Chrome and Firefox.
System must be configured to prefer dark, then light theme must be toggled on and remembered in the site. On page change or refresh, sometimes you'll get a frame or two where the dark theme is rendered first, then it flips over to the light theme as expected. With the demo site, because there's a transition enabled, you get the dark theme fading back into the light theme.
Hopefully a workaround is found for this!
The text was updated successfully, but these errors were encountered: