colorkt icon indicating copy to clipboard operation
colorkt copied to clipboard

Add Okhsl

Open aaronadamsCA opened this issue 2 years ago • 2 comments

Hi, this looks like a very promising library!

It would be great to add Okhsl, the cylindrical representation of Oklab:

https://bottosson.github.io/posts/colorpicker/ https://bottosson.github.io/posts/colorpicker/#source-code

This would specifically add support for perceptual saturation adjustments, which would boost use cases like palette generation.

aaronadamsCA avatar Feb 15 '22 14:02 aaronadamsCA

Sure, that could be done, but can you explain why you feel that adjusting Okhsl saturation would be better for palette generation? For Material You, results have been good when adjusting the chroma component of the polar representation of Oklab (Oklch: lightness, chroma, hue).

kdrag0n avatar Feb 15 '22 19:02 kdrag0n

Good question. To be clear, I am not saying Okhsl is better than Oklch; I just think it addresses a wider variety of use cases than Oklch alone, by improving the usability of the color space.

As I understand it:

  • Oklch is like a globe. Very accurate, but irregularly shaped, and therefore often challenging to use.

  • Okhsl is like a map. There are tradeoffs when projecting an irregular shape to a regular one, but as long as you understand those tradeoffs, it's much easier to use.

  • Material You draws 3D curves through Oklch. Very cool, but very complex! This requires resources well beyond those available to most teams, including mine.

  • Okhsl is specifically designed to provide useful linear paths, which map to perceptually uniform curves through Oklch.

  • Material You uses fairly consistent chroma throughout its set of tones. This results in very high saturation in both light and dark tones; I see this as an artistic choice to "punch up" palettes.

  • Okhsl can more easily generate palettes with consistent saturation. This appears to be a more common choice for color systems (including Material Design 2014), and it is what I would prefer as well.

aaronadamsCA avatar Feb 16 '22 11:02 aaronadamsCA