sandoche / Darkmode.js

🌓 Add a dark-mode / night-mode to your website in a few seconds
https://darkmodejs.learn.uno
MIT License
2.72k stars 176 forks source link

Tips on how to avoid the darkmode from flashing? #54

Closed itsdarrylnorris closed 3 years ago

itsdarrylnorris commented 3 years ago

Problem

I have added this library to an existing static site that I am building. However, every time someone clicks on a new page there is a flashing effect from the white background, which is the original site color.

ezgif com-video-to-gif (2)

This website is a static website, so there is no server rendering which makes it a bit more difficult to avoid the flash.

Do you guys have any tips on how to avoid or limit as much possible the flashing on static sites?

itsdarrylnorris commented 3 years ago

I ended up installing Turbolinks, which prevent the entire page from reloading and that seems to fix the flashing effect