Skip to content

Instantly share code, notes, and snippets.

@thagxt
Last active October 27, 2019 12:17
Show Gist options
  • Save thagxt/0f217a9406a99f5c803ac1a378d0bb0c to your computer and use it in GitHub Desktop.
Save thagxt/0f217a9406a99f5c803ac1a378d0bb0c to your computer and use it in GitHub Desktop.
Detect if the OS is in dark mode in browsers
/* 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