DEV Community


Discussion on: DYK your website can get a dark mode toggled by your operating system?

tomayac profile image
Thomas Steiner

The media query is now also supported in Chrome 76. To feature-detect if a browser supports it, you can use this snippet:

if (window.matchMedia('(prefers-color-scheme)').media !== 'not all') {
  console.log('🎉 Dark mode is supported');
Forem Open with the Forem app