[Cuis-dev] Oklab color space and Oklch
Juan Vuletich
juan at cuis.st
Tue Dec 9 09:21:25 PST 2025
Hi Luciano,
(below)
On 2025-11-30 12:44 PM, Luciano Notarfrancesco via Cuis-dev wrote:
> I've been playing with colors and found out about this color space.
> https://en.wikipedia.org/wiki/Oklab_color_space
>
> I'm sharing it in case anyone wants to play with this too. I
> implemented the two methods to create colors from parameters in this
> color space. It seems to be modern thing to use (see
> https://evilmartians.com/chronicles/oklch-in-css-why-quit-rgb-hsl for
> example). It makes it easy to generate palettes varying only the hue
> without changing perceived lightness (and changing chroma minimally if
> it doesn't fit in the sRGB gamut). For example, try:
>
> step := 360 / 10.0.
> 0 to: 360 - step by: step :: collect: [:h| ColoredBoxMorph new color:
> (Color okl: 0.75 c: 0.4 h: h)]
>
> Cheers,
> Luciano
This is very interesting and useful! I played with it a bit and love it.
I've already pushed it to GitHub.
A couple of questions / requests.
Why didn't you use 0.0 and 1.0 as min and max values?
Would you provide the conversion from sRGB (i.e. our Color instances) to
OkLCH? That is really needed too. I'd also want an instance creation
method that answers nil if parameters lie outside our sRGB space of
Color instances (i.e. if the OkLCH values can not be accurately
represented by an instance of Color). Does #okOrNilL:c:h: sound
reasonable? Any better option? With these two, I could do something like
#experimentsTowardsANewColorPalette but using this better color space.
Finally, it would be wonderful to migrate all our theme related stuff to
this. This is so much better! Also, all our 'groups of shades' and
'transformations' methods look so primitive... We really need to update
all that stuff.
Thanks,
--
Juan Vuletich
www.cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
More information about the Cuis-dev
mailing list