Color parse Tests

These tests parse different color formats and compare the result as JSON.

sRGB colors

blue {"spaceId":"srgb","coords":[0,0,1],"alpha":1}
transparent {"spaceId":"srgb","coords":[0,0,0],"alpha":0}
#ff0066 {"spaceId":"srgb","coords":[1,0,0.4],"alpha":1}
#f06 {"spaceId":"srgb","coords":[1,0,0.4],"alpha":1}
#ff006688 {"spaceId":"srgb","coords":[1,0,0.4],"alpha":0.5333333333333333}
#f068 {"spaceId":"srgb","coords":[1,0,0.4],"alpha":0.5333333333333333}
rgba(0% 50% 200% / 0.5) {"spaceId":"srgb","coords":[0,0.5,2],"alpha":0.5}
rgb(0 127.5 300 / .5) {"spaceId":"srgb","coords":[0,0.5,1.1764705882352942],"alpha":0.5}
rgba(0, 127.5, 300, 0.5) {"spaceId":"srgb","coords":[0,0.5,1.1764705882352942],"alpha":0.5}
rgb(10deg 10 10) TypeError

Lab and LCH colors

lab(100% 0 0) {"spaceId":"lab","coords":[100,0,0],"alpha":1}
Lab(100% 0 0) {"spaceId":"lab","coords":[100,0,0],"alpha":1}
lab(100 -50 50) {"spaceId":"lab","coords":[100,-50,50],"alpha":1}
lch(100% 0 0) {"spaceId":"lch","coords":[100,0,0],"alpha":1}
lch(100 50 50) {"spaceId":"lch","coords":[100,50,50],"alpha":1}
lch(100 50 450) {"spaceId":"lch","coords":[100,50,450],"alpha":1}

color()

color(srgb 0 1 .5) {"spaceId":"srgb","coords":[0,1,0.5],"alpha":1}
color(srgb-linear 0 1 .5) {"spaceId":"srgb-linear","coords":[0,1,0.5],"alpha":1}
color(display-p3 0 1 .5) {"spaceId":"p3","coords":[0,1,0.5],"alpha":1}
color(rec2020 0 1 .5) {"spaceId":"rec2020","coords":[0,1,0.5],"alpha":1}
color(a98-rgb 0 1 .5) {"spaceId":"a98rgb","coords":[0,1,0.5],"alpha":1}
color(prophoto-rgb 0 1 .5) {"spaceId":"prophoto","coords":[0,1,0.5],"alpha":1}
color(acescc 0 1 .5) {"spaceId":"acescc","coords":[0,1,0.5],"alpha":1}
color(acescg 0 1 .5) {"spaceId":"acescg","coords":[0,1,0.5],"alpha":1}
color(acescg 0 1 .5) {"spaceId":"acescg","coords":[0,1,0.5],"alpha":1}
color(xyz 0 1 .5) {"spaceId":"xyz-d65","coords":[0,1,0.5],"alpha":1}
color(xyz-d65 0 1 .5) {"spaceId":"xyz-d65","coords":[0,1,0.5],"alpha":1}
color(xyz-d50 0 1 .5) {"spaceId":"xyz-d50","coords":[0,1,0.5],"alpha":1}
color(display-p3 0 1 0 / .5) {"spaceId":"p3","coords":[0,1,0],"alpha":0.5}
color(display-p3) {"spaceId":"p3","coords":[0,0,0],"alpha":1}
color(display-p3 / .5) {"spaceId":"p3","coords":[0,0,0],"alpha":0.5}
color(display-p3 1) {"spaceId":"p3","coords":[1,0,0],"alpha":1}
color(display-p3 1 / .5) {"spaceId":"p3","coords":[1,0,0],"alpha":0.5}

hsl()

hsl(180, 50%, 50%) {"spaceId":"hsl","coords":[180,50,50],"alpha":1}
hsl(-180, 50%, 50%) {"spaceId":"hsl","coords":[-180,50,50],"alpha":1}
hsl(900, 50%, 50%) {"spaceId":"hsl","coords":[900,50,50],"alpha":1}
hsl(0deg 0% 0% / .5) {"spaceId":"hsl","coords":[0,0,0],"alpha":0.5}

hwb()

hwb(180 20% 30%) {"spaceId":"hwb","coords":[180,20,30],"alpha":1}