culori icon indicating copy to clipboard operation
culori copied to clipboard

Add to `clampChroma` option to clamp to P3 space

Open ai opened this issue 3 years ago • 2 comments

P3 space is widely used (any modern Apple tech) and give a lot of new color.

We are using clampChroma to generate dynamic accent color. It would be nice to be able to clamp chroma not just to fit sRGB, but also to fit P3.

ai avatar May 03 '22 21:05 ai

Hi @ai, thanks for the suggestion and sorry for the late response. This feature is captured in the PR:

  • https://github.com/Evercoder/culori/pull/165

It introduces more generic functions for clampChroma, clampRGB, and displayable.

danburzo avatar Jun 08 '22 18:06 danburzo

Cool! But this PR will break TypeScript PR.

Can we merge TS first? TS is very important for modern days DX.

ai avatar Jun 08 '22 18:06 ai

Although initially planned for https://github.com/Evercoder/culori/pull/165, the PR does not include an implementation of toGamut(), which this feature request is concerned with.

Some references on the topic:

  • https://github.com/w3c/csswg-drafts/issues/7653
  • https://github.com/w3c/csswg-drafts/issues/7610
  • https://github.com/w3c/csswg-drafts/issues/7071
  • https://github.com/LeaVerou/color.js/issues/154
  • https://github.com/LeaVerou/color.js/issues/63
  • https://github.com/w3c/csswg-drafts/issues/7135

danburzo avatar Mar 25 '23 21:03 danburzo