LeaVerou / css-almanac

Repo for planning & voting on which stats to study
https://projects.verou.me/mavoice/?repo=leaverou/css-almanac&labels=proposed%20stat
33 stars 3 forks source link

add in-gamut code #50

Closed svgeesus closed 3 years ago

svgeesus commented 3 years ago

Tests whether a given P3 color (as array of three coords in range [0-1] lies within the sRGB gamut. The code first linearizes the P3 coordinates, then converts to CIE XYZ and then to linear-light sRGB. The latter two stages are combined for efficiency, and the matrix multiply is also hard-coded.

LeaVerou commented 3 years ago

Did you test that it works using http://projects.verou.me/rework-utils ?

svgeesus commented 3 years ago

Did you test that it works using http://projects.verou.me/rework-utils ?

No, I only tested it standalone.

svgeesus commented 3 years ago

There was an integration bug (coords were malformed when passed to my function) which is now fixed, it works in Rework too.