495 B
495 B
title, tags, firstSeen, lastUpdated
| title | tags | firstSeen | lastUpdated |
|---|---|---|---|
| prefersLightColorScheme | browser,intermediate | 2020-05-04T12:50:35+03:00 | 2020-10-22T20:24:04+03:00 |
Checks if the user color scheme preference is light.
- Use
Window.matchMedia()with the appropriate media query to check the user color scheme preference.
const prefersLightColorScheme = () =>
window &&
window.matchMedia &&
window.matchMedia('(prefers-color-scheme: light)').matches;
prefersLightColorScheme(); // true