Menu

gitpiper

prefersLightColorScheme javascript Code Snippet in 2022

browserintermediate

Last Updated: 26 November 2022

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

javascript snippet similar to prefersLightColorScheme For You in November 2022

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2022 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️