MotionScript

@motion-script/core


@motion-script/core / parseColor

Function: parseColor()

parseColor(cssStr): NormalizedColor

Defined in: attributes/shape/fill/color/parser.ts:316

Parses a CSS color string into a normalized [R, G, B, A] array (0.0–1.0).

Supported formats: named colors (CSS + theme), hex, rgb/rgba, hsl/hsla, lab, lch, oklab, oklch, plus a Tailwind-style opacity suffix ("white/10"). Falls back to opaque black and logs a warning for unrecognised input.

Parameters

cssStr

string

Returns

NormalizedColor