Skip to content

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

Funksjon: parseHexColor() ​

parseHexColor(input): string

Beta

Validate and normalize a user-supplied hex color. This is the only entry point for untrusted input inn i generert CSS, så alt annet enn #rgb/#rrggbb blir avvist.

Parametere ​

input ​

string

A hex color, with or without the leading #.

Returnerer ​

string

Lowercase #rrggbb.

Kaster ​

TypeError when input ikke er en 3- eller 6-sifret hex-farge.