Documentation / @ripl/core / parseKeyword
Function: parseKeyword() ​
parseKeyword(
value):ColorRGBA|undefined
Defined in: packages/core/src/color/keywords.ts:178
Parses a CSS named color into an RGBA tuple, tolerating any casing and surrounding whitespace.
Unlike the format parsers this returns undefined rather than throwing, because a keyword cannot be recognised by shape — an unknown name is indistinguishable from a name of a color space Ripl does not implement.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
value | string | The color keyword, e.g. red, REBECCAPURPLE, or transparent. |
Returns ​
ColorRGBA | undefined
The RGBA tuple, or undefined when the name is not a CSS color keyword.