Evercoder/culori

Add P3 support to `displayable`

ai opened this issue · 2 comments

ai commented

displayable now supports only sRGB, but we have many P3 screens in Apple ecosystem (and Safari support for P3 colors in CSS).

Can we add displayableP3?

Hi @ai, thanks for the report.

I think it would be a good idea to have a more general inGamut(mode) -> function(color) method that covers all bounded color spaces. This depends on adding the reference ranges for all color spaces:

You could then write:

const displayableP3 = inGamut('p3');
displayableP3('color(rec2020 1 0.5 0)');

The term displayable has become somewhat of a misnomer now that the gamut has been extended beyond sRGB. When expressed as color(srgb ...), a color can be displayed even if it has components outside the [0, 1] range.

ai commented

I like this API 👍