ThemeStore
Defined in: src/ui/theme.ts:48
A persisted theme preference, bound to one localStorage key.
Properties
Section titled “Properties”| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
storageKey |
readonly |
string |
The localStorage key the preference lives under. | src/ui/theme.ts:50 |
Methods
Section titled “Methods”getResolvedTheme()
Section titled “getResolvedTheme()”getResolvedTheme(): ResolvedTheme;Defined in: src/ui/theme.ts:56
The concrete theme the stored preference resolves to right now.
Returns
Section titled “Returns”getThemePref()
Section titled “getThemePref()”getThemePref(): ThemePref;Defined in: src/ui/theme.ts:52
The stored preference (system when unset, invalid, or storage is unavailable).
Returns
Section titled “Returns”initTheme()
Section titled “initTheme()”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.
Returns
Section titled “Returns”() => void
setThemePref()
Section titled “setThemePref()”setThemePref(pref): void;Defined in: src/ui/theme.ts:54
Persist pref and notify subscribers.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
pref |
ThemePref |
Returns
Section titled “Returns”void
subscribeThemePref()
Section titled “subscribeThemePref()”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).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cb |
() => void |
Returns
Section titled “Returns”() => void