Gatsby Dark Mode (minimal example)
This codebase creates an "MVP" version of rehydration-safe, flicker-free Dark Mode. It's described in more detail on my blog:
https://joshwcomeau.com/gatsby/dark-mode/
You can also play with it live (though, fair warning, it's not a terribly exciting application): https://trusting-bose-add650.netlify.app
Notable files:
β’ gatsby-ssr.js β’ src/components/ThemeContext.js β’ src/constants.js