The prefers-color-scheme media query works the same way. The user can configure their operating system to use a light or dark theme. I specify different values of CSS variables for both modes and let the user's OS decide. This is the real power of the media query: Providing a consistent user experience from OS to web page.

3m read timeFrom opensource.com
Post cover image
Table of contents
The prefers-color-scheme media queriesUsing the CSS variablesConclusion
1 Comment

Sort: