Bug in displayable() in oklch
VojtechVidra opened this issue · 3 comments
Hi @danburzo,
I found a funny bug in displayable function. It seems like most (if not all) of the oklch colors are displayable with lightness around 0.5-1 regardless of chroma and hue.
You can try this:
culori.displayable({l: 0.6, c: 0.17, h: 153, mode: "oklch"}) // => false
culori.displayable({l: 0.7, c: 0.17, h: 153, mode: "oklch"}) // => true
culori.displayable({l: 0.9, c: 0.17, h: 153, mode: "oklch"}) // => true
culori.displayable({l: 1, c: 0.17, h: 153, mode: "oklch"}) // => false
Hi @VojtechVidra, here's a visualization of the Oklch color space with chroma 0.17
, hue: 153
: https://oklch.com/#66.2,0.17,153,100 For this chroma/hue combination, colors within the sRGB gamut (for which displayable
returns true
) correspond to the lightness range [0.66-0.9]
. So at least the results for the four examples given are expected.
Sorry, my bad.. I'm fighting a bit with the fact that LCH lightness is [0, 100] and OKLCH lightness is [0, 1].
Thanks for the reply and sorry for bothering 🙂
No worries, glad it's sorted!