Re: [csswg-drafts] [css-color-4] Gamut Mapping with Oklch - Odd Results (#7071)

@svgeesus wrote :

> Looking at your page, was the first column generated in coloraide too, like this:
> or by some other method?

This was created using the sample code in this repo.
But the same effect can be observed with color.js.

There is a noticeable shift in luminosity for non-real colors in the teal region.
Which is not really an issue when gamut mapping a single color defined by a stylesheet author, but becomes hard to avoid with interpolation for things like gradients.

https://colorjs.io/notebook/

```js
let colorALAB = new Color('lab(50%, -127, -127)');
let colorAOKLCH = colorALAB.to('oklch');
let colorA = new Color('color(oklch 0.42 1.95 191)');
let colorB = colorA.toGamut({method: 'oklch.chroma', space: 'srgb'});
let colorC = colorA.to('srgb');

let colorA2LAB = new Color('lab(50%, 0, 127)');
let colorA2OKLCH = colorA2LAB.to('oklch');
let colorA2 = new Color('color(oklch 0.56 0.19 102)');
let colorB2 = colorA2.toGamut({method: 'oklch.chroma', space: 'srgb'});
let colorC2 = colorA2.to('srgb');
```

_I do not want to drag the conversion off topic, so please ignore this if it is not relevant._



-- 
GitHub Notification of comment by romainmenke
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7071#issuecomment-1048631605 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 23 February 2022 10:19:08 UTC