HexToRGB
Color
stable
Convert a hexadecimal colour string to an sRGB object. Accepts 3-, 4-, 6- and 8-character hex values, with or without a leading "#".
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- hexrequisTHex
- Hexadecimal colour string. Short forms (3 or 4 chars) are expanded by doubling each digit.
API
Valeur de retour
La valeur retournée par cet util.
- sRGB colour object with r, g, b in [0, 255]. Alpha is provided as a decimal in [0, 1] when the hex string contains an alpha channel, otherwise undefined.
Usage
Exemples
Extraits de code prêts à coller.
Parse a 6-digit hex colour