DEV Community

Discussion on: Enabling Dark Mode On Websites Based On Surrounding Light

Collapse
 
antogarand profile image
Antony Garand

Very nice!

I'll try making a POC where the website becomes progressively darker based off the illuminance level, using css custom properties, if anyone is interested in joining me!

If someone wants to out the snippet using a real website, Brawldb is dark by default, but light when the body has the theme-light class.

It is usually toggled via the top-right menu, but should also work via this snippet.

Collapse
 
ananyaneogi profile image
Ananya Neogi

Definitely, go for it! :)

I also made a very simple demo web page sometime back. Check that out, if you wish, to see this code work instantly.