MCPcopy Create free account
hub / github.com/CapSoftware/Cap / getHexColorDigitCount

Function getHexColorDigitCount

apps/desktop/src/utils/hex-color.ts:23–31  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

21}
22
23export function getHexColorDigitCount(value: string) {
24 const trimmed = value.trim();
25 if (trimmed.length === 0) return 0;
26
27 const raw = trimmed.startsWith("#") ? trimmed.slice(1) : trimmed;
28 if (!/^[\dA-F]+$/i.test(raw)) return 0;
29
30 return raw.length;
31}
32
33export function normalizeOpaqueHexColor(value: string) {
34 const normalized = normalizeHexColor(value);

Callers 4

hex-color.test.tsFile · 0.90
RgbInputFunction · 0.90
HexColorInputFunction · 0.90
RgbInputFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected