UNPKG

ultra-design

Version:
12 lines (9 loc) 249 B
var hex = /[0-9A-F]/i; function validHex(value) { if (value.startsWith('#')) { value = value.slice(1); return hex.test(value[value.length - 1]); } return /\w/i.test(value) && !/\d/.test(value) || value === ''; } export { validHex };