From 6a3535ac05f14694a3a7e483d4f8dc21af3de26b Mon Sep 17 00:00:00 2001 From: James Stuckey Weber Date: Wed, 11 Oct 2023 08:51:07 -0400 Subject: [PATCH] Remove gamut mapping from hsl, hwb and hsv (#331) --- src/spaces/hsl.js | 1 - src/spaces/hsv.js | 5 ----- src/spaces/hwb.js | 1 - tests/conversions.html | 34 ++++++++++++++++++++++++++++++++++ tests/parse.html | 4 ++-- 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/spaces/hsl.js b/src/spaces/hsl.js index 7e842a9fd..afbb22043 100644 --- a/src/spaces/hsl.js +++ b/src/spaces/hsl.js @@ -68,7 +68,6 @@ export default new ColorSpace({ formats: { "hsl": { - toGamut: true, coords: [" | ", "", ""], }, "hsla": { diff --git a/src/spaces/hsv.js b/src/spaces/hsv.js index 4a733092f..b96c59010 100644 --- a/src/spaces/hsv.js +++ b/src/spaces/hsv.js @@ -54,10 +54,5 @@ export default new ColorSpace({ (l === 0 || l === 1)? 0 : ((v - l) / Math.min(l, 1 - l)) * 100, l * 100 ]; - }, - formats: { - color: { - toGamut: true, - } } }); diff --git a/src/spaces/hwb.js b/src/spaces/hwb.js index 8b47ca2d1..3ec5c14fc 100644 --- a/src/spaces/hwb.js +++ b/src/spaces/hwb.js @@ -52,7 +52,6 @@ export default new ColorSpace({ formats: { "hwb": { - toGamut: true, coords: [" | ", "", ""], } } diff --git a/tests/conversions.html b/tests/conversions.html index 9e5bb1936..395bb3d78 100644 --- a/tests/conversions.html +++ b/tests/conversions.html @@ -36,6 +36,7 @@ let convertToOK = convertTo("oklab"); let convertToOKLCh = convertTo("oklch"); let convertTosrgbLin = convertTo("srgb-linear"); +let convertToHSV = convertTo("hsv"); @@ -176,6 +177,39 @@

sRGB to HWB

+
+

Out of RGB gamut conversions

+ + + + + + + + + + + + + + + + +
color(rec2020 0 0 1) + + 230.639, -29.921, -5.0489
color(rec2020 0 0 1) + + 230.639, 179.655, 37.564
color(rec2020 0 0 1) + + 230.639, 128.483, 105.0489
+
+

sRGB to HSL

diff --git a/tests/parse.html b/tests/parse.html index 080f979a5..6fe783a71 100644 --- a/tests/parse.html +++ b/tests/parse.html @@ -351,8 +351,8 @@

hsl()

- - + +
{"spaceId":"hsl","coords":[NaN,0,0],"alpha":0.5}
hsl(90deg 0% 0% / .5){"spaceId":"hsl","coords":[90,0,0],"alpha":0.5}hsl(230.6 179.7% 37.56% / 1){"spaceId":"hsl","coords":[230.6,179.7,37.56],"alpha":1}
hsl(none, 50%, 50%)