themeSelector

Theme
stable

Compute the CSS selector that a theme block targets based on its name and mode. Returns `:root` for the default theme, `[data-theme="name"]` for named themes, and compound selectors when both name and mode are set.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

theme
required
IOrigamTheme
The theme descriptor. `name` and `mode` ("light" | "dark" | "auto") control which selector is emitted. A mode of "auto" is treated as absent.

API

Return value

The value returned by this util.

A CSS selector string: `:root`, `[data-theme="name"]`, `[data-mode="dark"]`, or a compound `[data-theme="name"][data-mode="dark"]`.

Usage

Examples

Ready-to-paste usage snippets.

Selector for various theme configurations

typescript