web api instance property
Navigator: preferences property
Limited availability
The preferences read-only property of the Navigator interface returns a PreferenceManager object for the current document. This is the entry point for the User Preferences API functionality.
Value
A PreferenceManager object.
Examples
Get color scheme preference
This example demonstrates how to query the user’s preferred color scheme.
if (navigator.preferences.colorScheme.value === "dark") {
// The user prefers a dark color scheme.
} else {
// The user prefers a light color scheme.
}
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.