DEV Community

loading...

Discussion on: Implement Dark Mode On Your Website.

Collapse
jonosellier profile image
jonosellier

Why not both?

@media (prefers-color-scheme: dark) {
    html.system {
        /* dark mode vars */
    }
}
html.dark {
    /* dark mode vars */
}
Enter fullscreen mode Exit fullscreen mode

And do the same check in the post but for a string via a switch. This also opens up the ability for different themes (maybe a dark mode that's actually light enough to blend in with the browser UI in dark mode, an amoled dark mode, a solarized mode, a few color-blind modes)