Skip to content

resolveCssColor

resolveCssColor(color, options?): ResolvedColor

Defined in: packages/format-css-color/src/resolve-css-color.ts:84

Evaluates a parsed colour to sRGB.

Separate from parsing because the two answer different questions: a linter wants to know what was written, a renderer wants a value. Relative colour syntax needs both — its origin is parsed, resolved, then read back as channels.

Out-of-gamut results are clamped rather than gamut-mapped; a caller that cares should map with @ac-kit/math-color first.

CssColor

ResolveOptions

ResolvedColor

For currentColor with no substitute given, or a channel keyword the notation does not expose.