My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

What are some ways of implementing a togglable “dark mode” on a website?

Alkshendra Maurya's photo
Alkshendra Maurya
·May 4, 2017

I’m curious on the ways of implementing color schemes that can be toggled on the fly on a website, something like the youtube/twitter dark modes:

 " \" \\" \\\"Youtube dark mode\\\"\\"\""

Easiest way would be to separate the color styles into a new stylesheet and apply a toggle class over the body.

Are there any other, better ways of doing it? perhaps using CSS variables?