On this page
Overview
Defines, stores, and applies color scheme, density, reduced motion, and large-text preferences.
- Artifact
AppearancePreferences.js· esm - Classification
public first party - Availability
Browser / native WebView hybrid - Normalization
Normalized values; storage/host failures remain mixed.
Import and lifecycle
import * as module from '/arcane/modules/AppearancePreferences.js';
May load or save through PreferenceStore and mutates root data attributes plus fontSize.
Application-facing behavior: appearancePreferenceSchema, createAppearancePreferenceStore(), applyAppearancePreferences(), loadAndApplyAppearancePreferences().
Protocol and host implementation
PreferenceStore, DOM, optional Arcane preferences This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
appearancePreferenceSchema | variable · value | variable appearancePreferenceSchema | — |
createAppearancePreferenceStore | function | function createAppearancePreferenceStore(options={}) | options={} |
applyAppearancePreferences | function | function applyAppearancePreferences(values={},root=document.documentElement) | values={},root=document.documentElement |
loadAndApplyAppearancePreferences | function | async function loadAndApplyAppearancePreferences(options={}) | options={} |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
createAppearancePreferenceStore | exported-function | function createAppearancePreferenceStore(options={}) | options={} |
applyAppearancePreferences | exported-function | function applyAppearancePreferences(values={},root=document.documentElement) | values={},root=document.documentElement |
loadAndApplyAppearancePreferences | exported-function | async function loadAndApplyAppearancePreferences(options={}) | options={} |
Parameter meanings and results
createAppearancePreferenceStore(options) returns the shared store. applyAppearancePreferences(values, root) returns values after applying scheme, density, motion, and text preferences; loadAndApplyAppearancePreferences(options) returns {store, values}.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
This artifact has no additional documented lifecycle event flow.
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- Preference storage and DOM failures propagate
Availability and capabilities
Browser / native WebView hybrid. Normalized values; storage/host failures remain mixed.
Uses Arcane preferences when available or browser storage through PreferenceStore; the rendered contract is host-normalized.
Contract example
import {applyAppearancePreferences} from '/arcane/modules/AppearancePreferences.js';
applyAppearancePreferences({
'appearance.colorScheme':'dark',
'appearance.density':'compact',
'accessibility.reduceMotion':true,
'accessibility.largeText':false
},document.documentElement);