Re: [css-houdini-drafts] [css-typed-om] Color conversion and contrast ratio (#989)

Note that Color 4 does include [sample code for color conversions](https://github.com/w3c/csswg-drafts/blob/master/css-color-4/conversions.js) and, while this is non-normative and illustrative, it does work. I used it to make a lot of the diagrams and examples for CSS Color 4 and 5.

It isn't necessarily a good API design, it was primarily intended to be super simple to read and understand.

To avoid cluttering the sample code, I put additional stuff that I needed in practice into a [separate utilities file](https://github.com/w3c/csswg-drafts/blob/master/css-color-4/utilities.js) which includes, for instance, the WCAG 2.x relative contrast ratio. Not just for sRGB, but for any color space (display-p3, Lab, and so on).

Lea and I have been working on a more modern, object oriented library for color conversions. We would be happy to demonstrate this at the next virtual F2F. The two produce equivalent results.

-- 
GitHub Notification of comment by svgeesus
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/989#issuecomment-664378724 using your GitHub account

Received on Monday, 27 July 2020 12:55:22 UTC