Skip to content

pantoken-root / plugins/pantoken/custom-theme-colors/src / parseHexColor

Fušla: parseHexColor() ​

parseHexColor(input): string

Behta

Validate and normalize a user-supplied hex color. This is the only entry point for untrusted input into generated CSS, so anything but #rgb/#rrggbb is rejected.

Parametera ​

input ​

string

A hex color, with or without the leading #.

Gullii / Gávdnat ​

string

Lowercase #rrggbb.

Heakserii / Geahččat ​

TypeError when input isn't a 3- or 6-digit hex color.