Skip to content

Commit

Permalink
[css-color-4] Update chromatic adaptation matrices to higher precision
Browse files Browse the repository at this point in the history
  • Loading branch information
svgeesus committed Nov 22, 2023
1 parent 4bd3561 commit 9c4db75
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions css-color-4/conversions.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,12 @@ function D65_to_D50(XYZ) {
// - convert from XYZ to retinal cone domain
// - scale components from one reference white to another
// - convert back to XYZ
// http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html
// see https://github.com/LeaVerou/color.js/pull/354/files

var M = [
[ 1.0479298208405488, 0.022946793341019088, -0.05019222954313557 ],
[ 0.029627815688159344, 0.990434484573249, -0.01707382502938514 ],
[ -0.009243058152591178, 0.015055144896577895, 0.7518742899580008 ]
[ 1.0479297925449969, 0.022946870601609652, -0.05019226628920524 ],
[ 0.02962780877005599, 0.9904344267538799, -0.017073799063418826 ],
[ -0.009243040646204504, 0.015055191490298152, 0.7518742814281371 ]
];

return multiplyMatrices(M, XYZ);
Expand All @@ -318,9 +319,9 @@ function D65_to_D50(XYZ) {
function D50_to_D65(XYZ) {
// Bradford chromatic adaptation from D50 to D65
var M = [
[ 0.9554734527042182, -0.023098536874261423, 0.0632593086610217 ],
[ -0.028369706963208136, 1.0099954580058226, 0.021041398966943008 ],
[ 0.012314001688319899, -0.020507696433477912, 1.3303659366080753 ]
[ 0.947386632323667, 0.28196156725620036, -0.1708280666484637 ],
[ -0.7357288996314816, 1.6804471734451398, 0.035992069603406264 ],
[ 0.029218329379919382, -0.05145129980782719, 0.7733468362356041 ]
];

return multiplyMatrices(M, XYZ);
Expand Down

0 comments on commit 9c4db75

Please sign in to comment.