API reference
theme
Import
Section titled “Import”import * as api from "@fungi.computer/stipe/theme";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | StipeTheme | One of Stipe’s shipped theme names. |
| type alias | ThemeListener | Receives the current theme after a matching attribute mutation. |
| constant | STIPE_THEMES | Curated themes shipped by Stipe; hosts may still install their own themes. |
| constant | stipeThemeSchema | Decode a shipped theme name at a serialized-data boundary. |
| function | applyTheme() | Set the Daisy theme name. Persistence and application policy stay with the host. |
| function | getTheme() | Read the Daisy theme name from the root element, when available. |
| function | subscribeTheme() | Subscribe to root data-theme mutations without owning browser policy. |
StipeThemetype alias
Section titled “StipeTheme”type StipeTheme = z.infer<typeof stipeThemeSchema>;One of Stipe’s shipped theme names.
ThemeListenertype alias
Section titled “ThemeListener”type ThemeListener = (theme) => void;Receives the current theme after a matching attribute mutation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
theme |
string |
Returns
Section titled “Returns”void
STIPE_THEMESconstant
Section titled “STIPE_THEMES”const STIPE_THEMES: readonly [ "light", "dark", "latte", "mocha", "readout", "readout-night", "field-guide", "field-guide-night", "embed", "embed-dark", "phosphor", "codec", "paper", "ember", "tide", "tape", "sunrise", "pirate-radio", "pirate-radio-night", "consulting", "consulting-ink", "consulting-night", "consulting-night-ink", "consulting-riso-latte", "consulting-riso-latte-ink", "consulting-riso-glomzy", "consulting-riso-glomzy-ink", "vishnu", "coin", "coin-night", "chamfer",];Curated themes shipped by Stipe; hosts may still install their own themes.
stipeThemeSchemaconstant
Section titled “stipeThemeSchema”const stipeThemeSchema: ZodEnum<{ codec: "codec"; embed: "embed"; embed-dark: "embed-dark"; readout: "readout"; readout-night: "readout-night"; latte: "latte"; mocha: "mocha"; light: "light"; dark: "dark"; field-guide: "field-guide"; field-guide-night: "field-guide-night"; phosphor: "phosphor"; paper: "paper"; ember: "ember"; tide: "tide"; tape: "tape"; sunrise: "sunrise"; pirate-radio: "pirate-radio"; pirate-radio-night: "pirate-radio-night"; consulting: "consulting"; consulting-ink: "consulting-ink"; consulting-night: "consulting-night"; consulting-night-ink: "consulting-night-ink"; consulting-riso-latte: "consulting-riso-latte"; consulting-riso-latte-ink: "consulting-riso-latte-ink"; consulting-riso-glomzy: "consulting-riso-glomzy"; consulting-riso-glomzy-ink: "consulting-riso-glomzy-ink"; vishnu: "vishnu"; coin: "coin"; coin-night: "coin-night"; chamfer: "chamfer";}>;Decode a shipped theme name at a serialized-data boundary.
applyTheme()function
Section titled “applyTheme()”function applyTheme(theme, root?): void;Set the Daisy theme name. Persistence and application policy stay with the host.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
theme |
string |
root? |
HTMLElement |
Returns
Section titled “Returns”void
getTheme()function
Section titled “getTheme()”function getTheme(root?): string | null;Read the Daisy theme name from the root element, when available.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
root? |
HTMLElement |
Returns
Section titled “Returns”string | null
subscribeTheme()function
Section titled “subscribeTheme()”function subscribeTheme(listener, root?): () => void;Subscribe to root data-theme mutations without owning browser policy.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener |
ThemeListener |
root? |
HTMLElement |
Returns
Section titled “Returns”() => void