xeoneux / next-dark-mode

🌑 Enable dark mode for Next.js apps
https://next-dark-mode.vercel.app
MIT License
218 stars 8 forks source link

Force dark mode #11

Closed 0xtoj closed 3 years ago

0xtoj commented 3 years ago

Hi there, is there a way to always force dark mode? Allow switching but if the user reload => dark mode

xeoneux commented 3 years ago

Sure, you can call switchToDarkMode as soon as your app loads. For example, call it in the _app.jsx's useEffect with an empty array as dependency