DEV Community

Discussion on: How to Write CSS for Both Light & Dark Display Modes

Collapse
 
cmuralisree profile image
Chittoji Murali Sree Krishna

I dont know about this, but I use javascript onclick() function to handle dark and light mode by just appending a css class to particular element, and can change back by clicking the same button or reloading the page

Collapse
 
sprite421 profile image
Nathan Pasko • Edited

That is absolutely a valid way to change between styles. Maybe I should've been more clear in my writing, that I'm interested in using the OS light/dark setting to affect CSS as a kind of responsiveness.

Collapse
 
hungnguyenkt profile image
Hung Nguyen Manh

Light/Dark Mode depends on OS you use, you no need to click on or off to switch mode.

Collapse
 
cmuralisree profile image
Chittoji Murali Sree Krishna

then its cool, i hope i knew this before, atleast i would saved my time instead of appending class to each and every section and styling them in a different way.
Thanks for the info