Created
September 12, 2024 06:30
-
-
Save channprj/965647e0146d88145bc926b1e4b0d463 to your computer and use it in GitHub Desktop.
How to detect os color scheme in JS
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
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