nuxt-modules / color-mode

Dark and Light mode with auto detection made easy with Nuxt 🌗
https://color-mode.nuxtjs.org
MIT License
1.08k stars 99 forks source link

[BUG] Flashbang 💥 FOUC 🫣 #204

Open PickleNik opened 1 year ago

PickleNik commented 1 year ago

there's a split-second light mode flash before the dark mode is applied

one possible solution could be to set background color based on @media(prefers-color-scheme: dark) in CSS by default and then let JS take over the theming

Reproduction Link

(demo from Readme, unmodified)

https://github.com/nuxt-modules/color-mode/assets/31113245/15bf6dce-1559-4e7a-9b78-e613c1019795

Steps to reproduce

see above

What is Expected?

seamless page load

What is actually happening?