COLOR_MAPPERS

const
Color

Record of parser functions keyed by CSS color-function name (rgb, rgba, hsl, hsla, hsv, hsva). Each function converts its channel arguments into an RGBA object, normalising via HSLtoRGB or HSVtoRGB where needed.

TypeScript

Definition

The TypeScript definition as found in the origam source. Click the copy icon to copy the snippet.

typescript

Entries

Values

All entries in this constant. Click a value to copy it to clipboard.

rgb: (r: number, g: number, b: number, a?: number) => ({r, g, b, a})
rgba: (r: number, g: number, b: number, a?: number) => ({r, g, b, a})
hsl: (h: number, s: number, l: number, a?: number) => HSLtoRGB({h, s, l, a})
hsla: (h: number, s: number, l: number, a?: number) => HSLtoRGB({h, s, l, a})
hsv: (h: number, s: number, v: number, a?: number) => HSVtoRGB({h, s, v, a})
hsva: (h: number, s: number, v: number, a?: number) => HSVtoRGB({h, s, v, a})

Ecosystem

Used by

Composables and components that consume this constant.

Usage

Examples

Ready-to-paste code snippets using this constant.

Parsing a CSS color string

typescript