Skip to content

Instantly share code, notes, and snippets.

Created November 17, 2021 23:03
What would you like to do?
Simple Dark mode detector
let matched = window.matchMedia('(prefers-color-scheme: dark)').matches;
if(matched) {
console.log('User has Dark mode');
else {
console.log('User has not enable Dark mode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment