Last active
October 27, 2019 12:17
-
-
Save thagxt/0f217a9406a99f5c803ac1a378d0bb0c to your computer and use it in GitHub Desktop.
Detect if the OS is in dark mode in browsers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Light mode */ | |
@media (prefers-color-scheme: light) { | |
body { | |
background-color: #FFFFFF; | |
color: #000000; | |
} | |
} | |
/* Dark mode */ | |
@media (prefers-color-scheme: dark) { | |
body { | |
background-color: #000000; | |
color: #FFFFFF; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment