MCPcopy Index your code
hub / github.com/adobe/react-spectrum / parse

Method parse

packages/react-stately/src/color/Color.ts:658–664  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

656 }
657
658 static parse(value: string): HSLColor | void {
659 let m: RegExpMatchArray | null;
660 if ((m = value.match(HSL_REGEX))) {
661 const [h, s, l, a] = (m[1] ?? m[2]).split(',').map(n => Number(n.trim().replace('%', '')));
662 return new HSLColor(normalizeHue(h), clamp(s, 0, 100), clamp(l, 0, 100), clamp(a ?? 1, 0, 1));
663 }
664 }
665
666 toString(format: ColorFormat | 'css' = 'css') {
667 switch (format) {

Callers

nothing calls this directly

Calls 2

clampFunction · 0.90
normalizeHueFunction · 0.85

Tested by

no test coverage detected