Instead of replacing the complete className of the body, only replace the dark/light part. If the dark/light does not exist yet, just add the newTheme
Why?
In some cases you might already have className on your body (in my case a "home" class). The current version of this plugin makes your site flash because it first removes the "home" class and later on it is added again by javascript. By only replacing the light/dark part, you will only modify the relevant part of the className and thus no more flashing 🔦 !
What does it do?
Instead of replacing the complete className of the body, only replace the
dark/light
part. If the dark/light does not exist yet, just add thenewTheme
Why?
In some cases you might already have
className
on your body (in my case a "home" class). The current version of this plugin makes your site flash because it first removes the "home" class and later on it is added again by javascript. By only replacing the light/dark part, you will only modify the relevant part of the className and thus no more flashing 🔦 !