diff --git a/src/spaces/lab-d65.js b/src/spaces/lab-d65.js index 821553d64..69b4abec0 100644 --- a/src/spaces/lab-d65.js +++ b/src/spaces/lab-d65.js @@ -68,7 +68,7 @@ export default new ColorSpace({ formats: { "lab-d65": { - coords: [" | ", "", ""], + coords: [" | ", " | [-1,1]", " | [-1,1]"], } } }); diff --git a/src/spaces/lab.js b/src/spaces/lab.js index 287b4c7fc..e3b8d2fe2 100644 --- a/src/spaces/lab.js +++ b/src/spaces/lab.js @@ -68,7 +68,7 @@ export default new ColorSpace({ formats: { "lab": { - coords: [" | ", "", ""], + coords: [" | ", " | [-1,1]", " | [-1,1]"], } } }); diff --git a/src/spaces/lch.js b/src/spaces/lch.js index 63867ebcd..00b359ace 100644 --- a/src/spaces/lch.js +++ b/src/spaces/lch.js @@ -61,7 +61,7 @@ export default new ColorSpace({ formats: { "lch": { - coords: [" | ", "", " | "], + coords: [" | ", " | ", " | "], } } }); diff --git a/src/spaces/oklab.js b/src/spaces/oklab.js index 8b916070d..353666ed8 100644 --- a/src/spaces/oklab.js +++ b/src/spaces/oklab.js @@ -68,7 +68,7 @@ export default new ColorSpace({ formats: { "oklab": { - coords: [" | ", "", ""], + coords: [" | ", " | [-1,1]", " | [-1,1]"], } } }); diff --git a/src/spaces/oklch.js b/src/spaces/oklch.js index 936bc07e8..3c6370168 100644 --- a/src/spaces/oklch.js +++ b/src/spaces/oklch.js @@ -62,7 +62,7 @@ export default new ColorSpace({ formats: { "oklch": { - coords: [" | ", "", " | "], + coords: [" | ", " | [0,1]", " | "], } } }); diff --git a/tests/parse.html b/tests/parse.html index 78efff303..51d8d4035 100644 --- a/tests/parse.html +++ b/tests/parse.html @@ -81,6 +81,14 @@

Lab and LCH colors

lab(100 -50 50) {"spaceId":"lab","coords":[100,-50,50],"alpha":1} + + lab(50% 25% -25% / 50%) + {"spaceId":"lab","coords":[50,31.25,-31.25],"alpha":0.5} + + + lab(100 -50 5 / .5) + {"spaceId":"lab","coords":[100,-50,5],"alpha":0.5} + lch(100% 0 0) {"spaceId":"lch","coords":[100,0,0],"alpha":1} @@ -89,6 +97,10 @@

Lab and LCH colors

lch(100 50 50) {"spaceId":"lch","coords":[100,50,50],"alpha":1} + + lch(50% 50% 50 / 50%) + {"spaceId":"lch","coords":[50,75,50],"alpha":0.5} + lch(100 50 450) {"spaceId":"lch","coords":[100,50,450],"alpha":1} @@ -96,6 +108,73 @@

Lab and LCH colors

+
+

Oklab colors

+ + + + + + + + + + + + + + + + + + + + + + + + + +
oklab(100% 0 0){"spaceId":"oklab","coords":[1,0,0],"alpha":1}
oklab(100% 0 0 / 0.5){"spaceId":"oklab","coords":[1,0,0],"alpha":0.5}
OKLab(100% 0 0){"spaceId":"oklab","coords":[1,0,0],"alpha":1}
oklab(42% 100% -50%){"spaceId":"oklab","coords":[0.42,0.4,-0.2],"alpha":1}
oklab(1 -0.20 0.20){"spaceId":"oklab","coords":[1,-0.2,0.2],"alpha":1}
oklab(10 -0.80 0.80){"spaceId":"oklab","coords":[10,-0.8,0.8],"alpha":1}
+
+
+

Oklch colors

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
oklch(100% 0 0){"spaceId":"oklch","coords":[1,0,0],"alpha":1}
oklch(100% 0 0 / 50%){"spaceId":"oklch","coords":[1,0,0],"alpha":0.5}
OKLch(100% 0 0){"spaceId":"oklch","coords":[1,0,0],"alpha":1}
oklch(1 0.2 50){"spaceId":"oklch","coords":[1,0.2,50],"alpha":1}
oklch(10 2 500 / 10){"spaceId":"oklch","coords":[10,2,500],"alpha":1}
oklch(100% 50% 50){"spaceId":"oklch","coords":[1,0.2,50],"alpha":1}
oklch(100% 150% 50){"spaceId":"oklch","coords":[1,0.6000000000000001,50],"alpha":1}
oklch(100% 0 30deg){"spaceId":"oklch","coords":[1,0,30],"alpha":1}
+
+

color()

@@ -104,52 +183,90 @@

color()

color(srgb 0 1 .5) {"spaceId":"srgb","coords":[0,1,0.5],"alpha":1} + + color(srgb 0 100% 50%) + {"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(srgb-linear 0 100% 50%) + {"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(display-p3 0% 100% 50%) + {"spaceId":"p3","coords":[0,1,0.5],"alpha":1} + color(rec2020 0 1 .5) {"spaceId":"rec2020","coords":[0,1,0.5],"alpha":1} + + color(rec2020 0 100% 50%) + {"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(a98-rgb 0 100% 50%) + {"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(prophoto-rgb 0 100% 50%) + {"spaceId":"prophoto","coords":[0,1,0.5],"alpha":1} + color(acescc 0 1 .5) {"spaceId":"acescc","coords":[0,1,0.5],"alpha":1} + + color(acescc 0 100% 50%) + {"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) + color(acescg 0 100% 50%) {"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 0 100% 50%) + {"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-d65 0 100% 50%) + {"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(xyz-d50 0 100% 50%) + {"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}