Skip to content

Function: canonicalColor() ​

ts
function canonicalColor(value): string | null;

Experimental

Parse any CSS color and return its canonical rgb()/rgba() string, or null if value is not a valid color. 'transparent' becomes rgba(0, 0, 0, 0).

Parameters ​

ParameterType
valueunknown

Returns ​

string | null

Released under the MIT License.