Are there ports of this library in other langauges? Although really, my question is: #368
-
Where is some JavaScript that implements sRGB <> HCT conversion and interpolation through HCT space, like this library does? I found this library: https://www.npmjs.com/package/@material/material-color-utilities I just wonder if anyone happens to know of any other JavaScript libraries, especially any that are out-of-the-box usable with a .js script + nodejs. Meanwhile, this Python library is brilliant and allowed me to quickly explore interpolation in many color spaces, which is very useful, thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I'm glad you found this useful.
Unfortunately, I'm not currently aware of other libraries that implement HCT other than https://www.npmjs.com/package/@material/material-color-utilities. There may be more, but I did not explore any. I know that they (Material) do support sRGB <> HCT conversion. It's definitely not the most intuitive, but once you figure out how it works, I think you can do what you need to. They also lock chroma to specific steps and such and are stuck with conversions to sRGB only. They also only convert to rounded RGB values, so you'll never get a higher resolution of 128.5 which also limits the wider gamut usage. I know they (Google) came up with the idea of HCT, but the way they implemented it was a bit odd to me. I'm probably the only one who has made a proper color space out of HCT (so far). What they have works well enough if you never leave sRGB though.
As far as I know, I'm the only one who attempted to implement HCT as a proper color space that can be converted to wider gamuts such as display-p3 and greater (up to the limit of what CAM16 can convert without the algorithm breaking down) and has better conversion resolution making wider gamuts practical. Material had very specific goals: tonal palettes and sRGB, and the implementation is tailored to that goal. We had different goals, so we approached our implementation to create a proper color space not limited to sRGB and with as high resolution as we could manage considering you have to approximate back to sRGB considering HCT is built out of two disparate color spaces that share nothing in common: LCh and CAM16. Anyway, I don't have a simple answer for you. While I am capable enough to probably port this to JS, I am not a JS developer and have no interest in taking on the maintenance burden of having a JS port of this. Even though my documentation has ColorAide working live in the browser, it is done so with a Python <> JS bridge using Pyodide. Using Material Color Utilities may be your best way forward. I don't recall if they have color interpolation/blending built-in to their library. I only used the Material library as a reference to confirm my output values made sense against theirs since I implemented the color space from scratch using their description of the space: glue CAM16 and LCh together 🙃. |
Beta Was this translation helpful? Give feedback.
I'm glad you found this useful.
Unfortunately, I'm not currently aware of other libraries that implement HCT other than https://www.npmjs.com/package/@material/material-color-utilities. There may be more, but I did not explore any. I know that they (Material) do support sRGB <> HCT conversion. It's definitely not the most intuitive, but once you figure out how it works, I think you can do what you need to. They also l…