Detect System Theme Preference Change Using JavaScript

JavaScript and CSS allow users to detect the user theme preference with CSS’ prefers-color-scheme media query. It’s standard these days to use that preference to show the dark or light theme on a given website. But what if the user changes their preference while using your app? To detect a system theme preference change using JavaScript, you need to combine matchMedia, prefers-color-scheme, and an event listener: window.matchMedia('(prefers-color-scheme: dark)') .addEventListener('change',({ matches }) ={ if (matches) { console.log("change to dark mode!") } else { console.log("change to light mode!") } }) The change event of the matchMedia API notifies you... more →
Posted in: JavaScript

Microsoft adds a dark theme and traffic hub to Windows maps for non insiders – MSPoweruser.com

MSPoweruser.com Microsoft adds a dark theme and traffic hub to Windows maps for non insidersMSPoweruser.comMicrosoft is rolling out another set of updates from the Insider preview rings to the general public's production ring. Microsoft is updating the Windows Maps app for the public branch of Windows 10, with new features in tow. First of all, there's a …and more » map app – Google News… more →
Posted in: Interactive Maps