Files
ccszjs/node_modules/stylelint/lib/utils/isValidHex.mjs
renjianbo 12ccebc477 sec
2026-07-18 16:31:27 +08:00

12 lines
260 B
JavaScript

const IS_VALID_HEX = /^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;
/**
* Check if a value is a valid 3, 4, 6 or 8 digit hex
*
* @param {string} value
* @returns {boolean}
*/
export default function isValidHex(value) {
return IS_VALID_HEX.test(value);
}