Description
From color-js/apps#11
For example
color(display-p3 0 1.5 0)
iscolor(rec2020 0.7082 1.528 0.1721)
and this ,correctly,gets gamut mapped because Rec BT.2020 is an SDR colorspace.But
color(rec2100-linear 0.5039 2.389 0.0447)
should not be gamut mapped, it is an HDR space where (1 1 1) is SDR white and HDR colors have one or more components above1
.I suspect this is because
rec2100-linear
is inheriting too much from the implementation ofrec2020-linear
.
I think the fix for rec2100-linear
is to use refRange
for the coords instead of range
. This would make the space unbounded so no gamut mapping would occur.
How should gamut mapping work for other color spaces like rec2100-pq
, rec2100-hlg
, acescg
and acescc
that have range
coordinates when the coordinates of a color are outside of the range of the color space.
For example:
new Color({space: "rec2100pq", coords: [1, 1, 1]}).toString({options: {inGamut: true}})
'color(rec2100-pq 1 1 1)'
new Color({space: "rec2100pq", coords: [1.01, 1, 1]}).toString({options: {inGamut: true}})
'color(rec2100-pq 0.58069 0.58069 0.58069)'
It seems a bit strange that color(rec2100-pq 1.01 1 1) is gamut mapped to color(rec2100-pq 0.58069 0.58069 0.58069)
. I would have expected the result to be color(rec2100-pq 1 1 1) when gamut mapping to the same color space (for rec2100-pq) but maybe my intuition is wrong?