Skip to content

Instantly share code, notes, and snippets.

@tomhodgins
Created July 10, 2020 16:41
Show Gist options
  • Save tomhodgins/567032f07dd0c9a225d0a60121c24249 to your computer and use it in GitHub Desktop.
Save tomhodgins/567032f07dd0c9a225d0a60121c24249 to your computer and use it in GitHub Desktop.
window.matchMedia('(prefers-color-scheme: dark)').addListener(list => {
console.log(
event.matches === true
? 'Dark mode enabled'
: 'Light mode enabled'
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment