Menu

gitpiper

prefersLightColorScheme javascript Code Snippet in 2024

browserintermediate

Last Updated: 21 September 2024

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 September 2024

Subscribe to our Newsletter

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

© 2024 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! ✌️