DEV Community

Discussion on: How to Implement a Dark Mode with CSS and 3 Simple Lines of Javascript

Collapse
eshimischi profile image
eshimischi

You don't need any JS for dark mode switching, easily do it with CSS only: css-tricks.com/dark-modes-with-css/

Collapse
lewiscowles1986 profile image
Lewis Cowles

You might want to combine that CSS with a cookie or something to omit the switch over if someone explicitly switches for a site.

Collapse
daveyhert profile image
David Herbert💻🚀 Author

True. But this was a beginners guide so I didn't want to do anything extra.

Collapse
daveyhert profile image
David Herbert💻🚀 Author

I'm aware of that method but it has little support with most browsers and as such is unusable in a production website/web app.

But like I said initially, there are several ways to go about implementing anything.