Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the correct inverse matrix #360

Merged
merged 1 commit into from Nov 24, 2023
Merged

Conversation

facelessuser
Copy link
Collaborator

The scaled_cone_M was accidentally used as the inverse matrix. The proper one is now used. This is calculated directly by color.js and logged to the console instead of pre-calculating. This matrix is calculated when going from a D50 color space to D65.

@facelessuser
Copy link
Collaborator Author

For sanity, here is the Color.js output.

{
  scaled_cone_M: [
    [ 0.947386632323667, 0.28196156725620036, -0.1708280666484637 ],
    [ -0.7357288996314816, 1.6804471734451398, 0.035992069603406264 ],
    [ 0.029218329379919382, -0.05145129980782719, 0.7733468362356041 ]
  ],
  adapt_M: [
    [ 1.0479297925449969, 0.022946870601609652, -0.05019226628920524 ],
    [ 0.02962780877005599, 0.9904344267538799, -0.017073799063418826 ],
    [ -0.009243040646204504, 0.015055191490298152, 0.7518742814281371 ]
  ]
}
{
  scaled_cone_M: [
    [ 0.8456990870083072, 0.25169728162106253, -0.15249227197312118 ],
    [ -0.764955733398403, 1.7472029447856086, 0.03742185472636816 ],
    [ 0.05178975088972644, -0.09119789038422266, 1.3707642034977467 ]
  ],
  adapt_M: [
    [ 0.955473421488075, -0.02309845494876471, 0.06325924320057072 ],
    [ -0.0283697093338637, 1.0099953980813041, 0.021041441191917323 ],
    [ 0.012314014864481998, -0.020507649298898964, 1.330365926242124 ]
  ]
}

@facelessuser facelessuser mentioned this pull request Nov 22, 2023
@romainmenke
Copy link

romainmenke commented Nov 22, 2023

Thanks @facelessuser!

These values give good results for us : csstools/postcss-plugins#1179

@facelessuser
Copy link
Collaborator Author

Yeah, I'm usually more careful, but at least it's more on track now 🙃.

@facelessuser
Copy link
Collaborator Author

This should probably get updated in CSS spec as well. I saw it was updated with my fault inverse recently 😬.

@svgeesus
Copy link
Member

This should probably get updated in CSS spec as well. I saw it was updated with my fault inverse recently

Will do!

@svgeesus svgeesus merged commit d66e786 into color-js:main Nov 24, 2023
4 checks passed
@svgeesus
Copy link
Member

CSS sample code updated w3c/csswg-drafts@5ae7930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants