Skip to content

pantoken-root / plugins/pantoken/custom-theme-colors/src / deriveCustomColorScale

Function: deriveCustomColorScale() ​

deriveCustomColorScale(hex, tokens?): CustomColorScale

Beta

Derive the custom primitive scale from a brand hex. The input is anchored at the step whose reference lightness (the mean OKLCH lightness of the 13 shipped families) is nearest its own, then every step is rebuilt at its reference lightness with the input's hue — so the anchor step lands close to, but not necessarily exactly on, the input.

Parameters ​

hex ​

string

A #rgb/#rrggbb brand colour.

tokens? ​

readonly Token[]

Optional token array or map to resolve primitive step colour values from.

Returns ​

CustomColorScale

The CustomColorScale.

Throws ​

TypeError when hex isn't a valid hex colour.