function parseCssColor
parseCssColor(text: string): Rgba | undefined

Returns the color text writes as a hex (3, 4, 6 or 8 digits), an rgb() or rgba() of numbers or percentages, or one of the common names; undefined for any other form. Channels out of range are clamped.

Parameters

text: string

Return Type

Rgba | undefined

Usage

import { parseCssColor } from "api/lib/css-color.ts";