Skip to content

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

פונקציה: parseHexColor() ​

parseHexColor(input): string

בטא

Validate and normalize a user-supplied hex color. This is the only entry point for untrusted קלט אל CSS הנוצר, כך שכל דבר שאינו #rgb/#rrggbb יידחה.

פרמטרים ​

input ​

string

A hex color, with or without the leading #.

מחזיר ​

string

Lowercase #rrggbb.

מייצר שגיאה ​

TypeError כאשר input אינו צבע hex של 3 או 6 ספרות.