DEV Community

loading...

Discussion on: Light/dark mode: avoid flickering on reload

Collapse
jonrandy profile image
Jon Randy

Or use cookies and do it server side

Collapse
ayc0 profile image
Ayc0 Author

Even with cookies and server rendering, you might still have to do something similar if you aim to support a "system" mode that depends on users' os settings.

The only way to query it is with a media query in the front-end.

Collapse
jonrandy profile image
Jon Randy

This is true for a 'system' mode. Unless browsers send maybe a 'prefers' header relating to dark mode in their intial request, which I don't think they do. That would actually be a great thing for browsers to add!