Padheye.com : Discover Excellence

The Path To Discover Excellence.

Friday, 2 March 2018

Implement Dark Mode On Your Website.

👋 Interesting approach but why not leave theme detection to browser?

:root {
    color-scheme: light dark;
    --special-text-color: #000
}

@media (prefers-color-scheme: dark) {
    :root {
        --special-text-color: #FFF;
    }
}

body, html {
    height: 100%;
    color-scheme: light dark; 

} 

No comments:

Post a comment