parseColor

Commons
stable

Normalise any supported color representation — integer, CSS string (hex, rgb, rgba, hsl, hsla, hsv, hsva), or an RGBA/HSLA/HSVA object — into a unified `TRGBA` object.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

color
requis
TColorType
Any color value accepted by the design system: a 24-bit integer (0x000000–0xFFFFFF), a CSS color string (`"#rrggbb"`, `"rgb(…)"`, `"hsl(…)"`, etc.), or a plain `{r,g,b}` / `{h,s,l}` / `{h,s,v}` object.

API

Valeur de retour

La valeur retournée par cet util.

A normalised `{ r, g, b, a? }` object with channel values in the range 0–255 (and `a` in 0–1).

Usage

Exemples

Extraits de code prêts à coller.

Parse various color formats

typescript