insin / gatsby-plugin-dark-mode

A Gatsby plugin which handles some of the details of implementing a dark mode theme
MIT License
68 stars 19 forks source link

Only replace the dark/light string in body #4

Closed robbinjanssen closed 4 years ago

robbinjanssen commented 5 years ago

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 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 🔦 !

wassim commented 4 years ago

@insin Please merge.

insin commented 4 years ago

Thanks!