web api interface
PreferenceManager
Limited availabilitySecure context
The PreferenceManager interface of the User Preferences API provides access to PreferenceObject objects used to query and modify user preferences.
The PreferenceManager for the current document can be accessed via the preferences property.
The PreferenceManager interface inherits from EventTarget.
Instance properties
colorSchemeRead only Experimental- : A
PreferenceObjectused to override the user’s preference for the color scheme of the site.
- : A
contrastRead only Experimental- : A
PreferenceObjectused to override the user’s preference for the contrast of the site.
- : A
reducedMotionRead only Experimental- : A
PreferenceObjectused to override the user’s preference for the reduced motion of the site.
- : A
reducedTransparencyRead only Experimental- : A
PreferenceObjectused to override the user’s preference for the reduced transparency of the site.
- : A
reducedDataRead only Experimental- : A
PreferenceObjectused to override the user’s preference for the reduced data of the site.
- : A
Examples
Basic usage
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.