Menu

1 / 5

Chris’ Corner: Colors – CodePen

#codepen#color#gradient#space#oklch
Reading 0:00
15s threshold

Gradients can look super different depending on what color space you have them interpolate in. It’s sRGB by default, and there is a decent chance you’ve never even thought about it. But it’s a small syntax change to change that, as Keith Grant documents .

One of those is not better than the other. Maybe it’s a bummer that the color desaturates midway through the sRGB range, but maybe the trip to bright green town is a bummer in OKLCH. Or maybe they are perfect! The point of Keith’s article is that unexpected colors can appear between colors across various color spaces, and it can almost feel like a bug.

There are more color spaces to try: srgb , srgb-linear , display-p3 , display-p3-linear , a98-rgb , prophoto-rgb , rec2020 , xyz , xyz-d50 , or xyz-d65 . Here’s a good visual .

OKLCH certainly isn’t immune to weird colors in gradient interpolation, but I do generally think it does a good job and remains my favorite color space.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.