Skip to content

ThemeStore

Defined in: src/ui/theme.ts:48

A persisted theme preference, bound to one localStorage key.

Property Modifier Type Description Defined in
storageKey readonly string The localStorage key the preference lives under. src/ui/theme.ts:50
getResolvedTheme(): ResolvedTheme;

Defined in: src/ui/theme.ts:56

The concrete theme the stored preference resolves to right now.

ResolvedTheme


getThemePref(): ThemePref;

Defined in: src/ui/theme.ts:52

The stored preference (system when unset, invalid, or storage is unavailable).

ThemePref


initTheme(): () => void;

Defined in: src/ui/theme.ts:68

Standalone SPA only: apply the stored preference to <html data-theme> and keep it in sync (toggle + OS changes). Call once at boot, before first paint. Returns the unsubscribe function. The React embed does not call this — it themes its own wrapper.

() => void


setThemePref(pref): void;

Defined in: src/ui/theme.ts:54

Persist pref and notify subscribers.

Parameter Type
pref ThemePref

void


subscribeThemePref(cb): () => void;

Defined in: src/ui/theme.ts:62

Subscribe to changes of the resolved preference theme — an explicit setThemePref or, under system, the OS scheme flipping. Returns the unsubscribe function (useSyncExternalStore-compatible).

Parameter Type
cb () => void

() => void