Detecting Users’ OS Dark Mode Preference Using matchMedia() using JavaScript. For many users, dark mode provides a more eye-friendly interface with fewer white tones that can cause eyestrain. In JavaScript, you can takes advantage of the Window interface’s match media() method to check the value of the prefers-color-scheme CSS feature.

1m read timeFrom medium.com
Post cover image
4 Comments

Sort: