semanticTreeToVars

Theme
stable

Walk a hand-authored semantic token tree depth-first and emit a flat map of CSS custom property names to their leaf values, prefixed with a given root path.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

tree
required
ISemanticTree
The nested token tree (string/number leaves, object branches). Each leaf path becomes a CSS variable name.
rootPath
required
ReadonlyArray<string>
The prefix path segments to prepend before each leaf path when building the CSS variable name.

API

Return value

The value returned by this util.

A flat Record<string, string | number> mapping each "--origam-*" CSS variable to its token value.

Usage

Examples

Ready-to-paste usage snippets.

Flatten a color subtree

typescript