Skip to content

Instantly share code, notes, and snippets.

@channprj
Created September 12, 2024 06:30
Show Gist options
  • Save channprj/965647e0146d88145bc926b1e4b0d463 to your computer and use it in GitHub Desktop.
Save channprj/965647e0146d88145bc926b1e4b0d463 to your computer and use it in GitHub Desktop.
How to detect os color scheme in JS
const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment