Live data from Hacker News

What are OKLCH colors?

jakub.kr

111–120 of 189 posts

Re: What are OKLCH colors?

#111
post #57

Earlier quoted context omitted.

Also, isn't the way browsers interpolate colors in sRGB just a bug that I assume is retained for backwards compatibility? sRGB is a logarithmic encoding, you were never supposed to interpolate between colors directly in that encoding - the spec says you're suppose to convert to linear RGB first and do the interpolation there...

It's not a bug, its a property of the colour space. Which is partially tied to how the colour is represented (RGB). When doing linear interpolation through the RGB cube (for eg a gradient), you normally pick the shortest path. It just so happens that sometimes that path passes thorough some shade of gray as different colour components are scaled. Usually you fix it by moving your point through a different colour spac…

[deleted]

Re: What are OKLCH colors?

#112

How does oklch compare to CIELCh(uv)? I've been using that seemingly similar system to pick uniform colors.

Here's the original post explaining the color space. The ideas are very similar, OKLAB used a different white point

https://bottosson.github.io/posts/oklab/#what-about-existing...

Re: What are OKLCH colors?

#113

Earlier quoted context omitted.

For any really bigger color space, you would have to use more than 3 primary colors, which would increase a lot the cost. Moving the monochromatic BT.2020 colors from 630 nm, 532 nm and 467 nm could get a little increase in color space coverage, but at the expense of a lower efficiency in power consumption to brightness conversion. 467 nm is not a very pure blue, but the sensitivity of the eye drops very quickly in t…

> For any really bigger color space, you would have to use more than 3 primary colors, which would increase a lot the cost. Unless you want to make displays for the bees and birds (and the tiny alleged minority of human tetrachromats) that seems rather pointless. People with three color receptors are your customers, so that's driving the market. I rather predict, future displays will further improve on contrast, incl…

This has nothing to do with tetrachromatism.

The border of the color space corresponding to monochromatic colors is convex, so any triangle inscribed in that curve border will leave parts of the color space that cannot be reproduced on a display.

The convexity of the border means that if you compute the 3 coefficients of RGB colors that match a desired color, there will always be some colors that need one negative coefficient, regardless of the choice for the RGB primary colors. On any display, it is impossible to realize a negative brightness of a color, so on a RGB display there will always be some colors whose hue and brightness can be reproduced, but their saturation cannot be reproduced.

The only way to make smaller the parts of the color space that cannot be reproduced is to take more points on the monochromatic border, replacing the triangle of reproducible colors with a polygon that fits more closely the curved border.

The entire color space perceived by humans could be reproduced on a display only with tunable lasers, not with fixed-frequency primary colors. One could use fixed-frequency primary colors only if they would stimulate directly the photoreceptors in the eye, to enable workarounds for the overlapping filter characteristics of the cones and for the signal processing done in the retina.

Re: What are OKLCH colors?

#114
post #25

Great post! Also check out oklch.com, I found it useful for building an intuition. Some stumbling blocks are that hues aren’t the same as HSL hues, and max chroma is different depending on hue and lightness. This isn’t a bug, but a reflection of human eyes and computer screens; the alternative, as in HSL, is a consistent max but inconsistent meaning. Another very cool thing about CSS’s OKLCH is it’s a formula, so you…

OKLCH plus relative colors let me seriously reduce the amount of hardcoded colors from my style sheet:

https://github.com/hazelgrove/hazel/blob/dev/src/web/www/sty...

Re: What are OKLCH colors?

#116
post #85
post #80

Earlier quoted context omitted.

One could also argue that the detour through other hues is necessary in this case to avoid going through grey.

Gray is arguably just another color, it’s not clear why you’d want to avoid it. How is going via red and yellow better than going via gray? Varying hue is often perceived as a larger change than varying saturation or lightness. A path going through several distinct hues is visually less uniform than one going through gray once.

Let's say you continuously change wavelength of a laser from blue (~480nm) to red (~630nm), you are going through green, not through gray. If in your use case going through gray makes sense, that's ok, there may be many paths from one color to another.

Re: What are OKLCH colors?

#117

> In the example above, you can see that the OKLCH colors maintain consistent blueness across all of the shades, while in the HSL example, the lighter shades drift to purple and the darker ones muddy out towards grayish. There is a very clear shift towards green in the OKLCH lightness value change example, enormously more so than any purple vibe in the HSL example. Clearly being able to select colours of the same per…

You can see why by looking at the Hue chart for this color: https://oklch.com/#0.7684,0.1754,218.1,100 To increase brightness past the limit of the Hue band for the color, the rendered output color on a display shifts cyan due to the limited brightness range of a saturated blue in the Display P3 color space. OKLCH is, when varying brightness along a gradient, Saturation-invariant rather than Hue-invariant; whether th…

> You can see why by looking at the Hue chart for this color

This misses the point: the example claims the hue isn't shifting, when it very clearly is. It's not a question of why.

Re: What are OKLCH colors?

#118

Earlier quoted context omitted.

You can see why by looking at the Hue chart for this color: https://oklch.com/#0.7684,0.1754,218.1,100 To increase brightness past the limit of the Hue band for the color, the rendered output color on a display shifts cyan due to the limited brightness range of a saturated blue in the Display P3 color space. OKLCH is, when varying brightness along a gradient, Saturation-invariant rather than Hue-invariant; whether th…

> You can see why by looking at the Hue chart for this color This misses the point: the example claims the hue isn't shifting, when it very clearly is. It's not a question of why.

The hue isn’t shifting in OKLCH at all; also, it’s definitely shifting when OKLCH is rendered to Display P3 or sRGB. This is normal and expected behavior for colorspace gradients when rendered to device profiles? But I suspect I’m too close to the problem to see what’s not explained properly, apologies.

Re: What are OKLCH colors?

#119
post #101
post #70

Earlier quoted context omitted.

There’s no green shift at all in that example on my display. Could your calibration be off?

There certainly is ... run a color picker over it.

I opened the macOS Digital Color Meter and set it to "native values" mode. The second-to-last OKLCH swatch has a green component of 202, and the last has a green component of 226. The corresponding values in the HSL swatches are 203 and 227.

Basically no difference at all.

Post reply on HN