Which feature would you use to determine a user's preferred color scheme (light or dark mode) in modern browsers?
To detect color scheme preference, you use window.matchMedia with the prefers-color-scheme media query: 1) This CSS media feature detects whether the user has requested light or dark color themes, 2) window.matchMedia returns a MediaQueryList object that can check if the query currently matches, 3) The query '(prefers-color-scheme: dark)' specifically checks for dark mode preference, 4) While technically not part of the Navigator interface, this is the standard way to access this user preference, 5) It can be used to dynamically apply different styles or themes based on user preference, 6) The MediaQueryList object's matches property indicates whether the preference is currently active, 7) You can also listen for changes with addEventListener('change', callback) on the returned object, 8) This approach is more aligned with the CSS standards than having a dedicated Navigator property.