light.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(); // trueSubscribe to get resources directly to your inbox. You won't receive any spam! ✌️