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

Implement Oklab and Oklch #222

Closed
Artoria2e5 opened this issue May 10, 2021 · 3 comments · Fixed by #200
Closed

Implement Oklab and Oklch #222

Artoria2e5 opened this issue May 10, 2021 · 3 comments · Fixed by #200

Comments

@Artoria2e5
Copy link

Artoria2e5 commented May 10, 2021

Oklab is a simple perceptual color space that aims to be a more uniform replacement of CIE Lab. It mostly delivers on that goal in its intended use of D65 whitepoint SDR colors.

Oklch is natural cylindrical variant of Oklab. The author also had the idea of a sRGB-in-Oklch boundary in gamut mapping, which I mentioned in #221.

The basic XYZ-to-oklab definition is based on an assumption of D65 whitepoint. Any chromatic adaptation would be an extension. For that I recommend going with the CAM16-UCS matrix, since that's where its data for fitting comes from (Bradford is probably close enough too). (You could use the pseudo-LMS implied by the M1 matrix to do that, but it's not designed for that purpose and there's probably no real computational savings.)

(I am super fine with putting this off until we figure out how to write less boilerplate. In my dream world you would just tell a very intelligent thing which are which, but macros need humans to write too.)

@Ogeon
Copy link
Owner

Ogeon commented May 10, 2021

There is an open, but currently inactive, PR for Oklab: #200. We decided to only allow conversion if the current color space is using D65, so chromatic adaptation has to be done "manually", to avoid making it too "magic". Keeping converting and adaptation separate makes the type inference less brittle and implementations simpler. Not to mention leaving the matrix selection to the user.

My intention for the PR is to either let it sit until I have gotten around to make a release, or to make sure it's solid and includes Oklch as well.

And let's not worry about the boiler plate for now.

@Artoria2e5
Copy link
Author

I saw that PR like... five minutes ago, and now I am wondering how I missed it...

@Ogeon Ogeon mentioned this issue Jul 4, 2021
@Ogeon
Copy link
Owner

Ogeon commented Jul 4, 2021

Implemented in #200.

@Ogeon Ogeon closed this as completed Jul 4, 2021
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 a pull request may close this issue.

2 participants