Skip to content

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

دالة: parseHexColor() ​

parseHexColor(input): string

Beta

Validate and normalize a user-supplied hex color. This is the only entry point for untrusted الإدخال إلى CSS المُولّد، لذلك يُرْفَض كل ما هو غير #rgb/#rrggbb.

Parameters ​

input ​

string

A hex color, with or without the leading #.

Returns ​

string

Lowercase #rrggbb.

Throws ​

TypeError عندما input ليس لونًا سداسيًا مكوّنًا من 3 أو 6 خانات.