Skip to content

pantoken / packages/utils/src / colorUtilitiesCss

Function: colorUtilitiesCss()

colorUtilitiesCss(names, options?): string

Beta

Build the semantic-colour utility stylesheet: .<prefix>-bg-<name> (background), .<prefix>-text-<name> (text colour), .<prefix>-border-<name> (border colour), one per semantic colour token. .<prefix>-color-<name> is emitted alongside .<prefix>-text-<name> as an alias — same declaration, either class name works. Overrides are therefore only ever token-valid — no primitives, no arbitrary hex. Pass the token names per family (e.g. from @pantoken/tokens), or an explicit [name, token] pair to source a name from a different token than the family's own scale.

Parameters

names

ColorUtilityNames

ColorUtilityNames.

options?

UtilityOptions = {}

UtilityOptions.

Returns

string

The CSS string.