applyTheme

Theme
stable

Inject (or replace) a single theme's CSS variable block into <head> at runtime. SSR-safe: returns null when document is unavailable or the theme is empty.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

theme
required
IOrigamTheme
The theme object containing name, mode (light | dark), and the CSS variable map to inject.

API

Return value

The value returned by this util.

The id of the injected <style> element (keyed by name × mode), or null when skipped (SSR or empty theme).

Usage

Examples

Ready-to-paste usage snippets.

Inject a brand theme at runtime

typescript