extractColor

ColorPicker
stable

Converts an internal HSVA color value to the format expected by the consumer (string → hex, RGB object, HSL object, or HSV object), preserving alpha when appropriate.

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
THSVA
The internal HSVA color value to convert. THSVA = { h: number, s: number, v: number, a?: number }.
input
requis
any
The original input value passed to the color picker. Its type determines the output format: null/string → hex string; { r, g, b } → RGB object; { h, s, l } → HSL object; { h, s, v } → HSV object.

API

Valeur de retour

La valeur retournée par cet util.

The color in the same format as the input. Alpha is stripped when the original input had no alpha channel and the alpha value is 1.

Usage

Exemples

Extraits de code prêts à coller.

Extract to hex vs RGB object

typescript