MCPcopy Create free account
hub / github.com/adobe/react-spectrum / parseColor

Function parseColor

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

Source from the content-addressed store, hash-verified

27
28/** Parses a color from a string value. Throws an error if the string could not be parsed. */
29export function parseColor(value: string): IColor {
30 let res = RGBColor.parse(value) || HSBColor.parse(value) || HSLColor.parse(value);
31 if (res) {
32 return res;
33 }
34
35 throw new Error('Invalid color value: ' + value);
36}
37
38export function normalizeColor(v: string | IColor): IColor {
39 if (typeof v === 'string') {

Callers 15

useColorAreaGradientFunction · 0.90
useColorSwatchFunction · 0.90
Color.test.tsxFile · 0.90
useColor.test.jsFile · 0.90
useColorFieldStateFunction · 0.90
addColorValueFunction · 0.90
getDisplayColorFunction · 0.90
setColorFunction · 0.90

Calls 1

parseMethod · 0.45

Tested by 4

TestFunction · 0.72
TestFunction · 0.72
TestFunction · 0.72
TestFunction · 0.72