Usage
data-theme on the document element. createAppearancePreference writes light or dark there for AppearanceMode.Light, AppearanceMode.Dark, or AppearanceMode.System.
initial: AppearanceMode.Dark or AppearanceMode.Light.data-theme on the popup's own document or container.@prepared911/ui.AppearanceMode.System follows prefers-color-scheme and keeps following it while the page is open. A system change animates like any other change. A change that does not alter the resolved appearance does not animate.
Call dispose() when the owner of the preference goes away so the page stops listening to the system setting.
createAppearancePreference animates through transitionAppearance. Nothing animates when the document has no startViewTransition, when prefers-reduced-motion: reduce matches, or when <html> has data-motion="reduced". The new appearance is still applied.
User-facing theme labels (“Dark”, “Light”, “System”) use formatMessage.
@prepared911/ui does not ship ThemeProvider. The page appearance is data-theme on the document element, through createAppearancePreference. A subtree that must stay light or dark imports themeRegionProps and ThemeRegionAppearance from @prepared911/ui and spreads the result. That region does not cover a popup portaled to the document.