Björn Ottosson
bottosson.github.io · Personal blog · on HN since 2020
Björn Ottosson writes about color science for graphics, including the Oklab color space, gamut clipping, and how software handles color incorrectly.
What HN saysHN commenters recommend Oklab as simpler than CIELab and better than HSL/HSV, and cite his post on why linear color is poor for gradients.
62HN people shared it
52linked it in comments
14stories submitted
748story points
8 months agolast shared
2020people per year2026
Most-shared posts
- 1Oklab: A perceptual color space for image processing40 people · 239 points · first shared 2020 · 89 comments on HN
- 2New alternatives to HSL and HSV that better match color perception12 people · 404 points · first shared 2021 · 79 comments on HN
- 3Interactive Color Picker Comparison6 people · 2 points · first shared 2021 · discussion on HN
- 4sRGB Gamut Clipping (2021)5 people · 97 points · first shared 2021 · 47 comments on HN
- 5How software gets color wrong5 people · 6 points · first shared 2020 · discussion on HN
- 6Hue oklab.png1 people · first shared 2020
- 7Okhsl circle.png1 people · first shared 2021
- 8Hsl blue.png1 people · first shared 2025
- 9Hsv picker.png1 people · first shared 2021
- 10Homepage1 people · first shared 2022
- 11Posts1 people · first shared 2023
What HN people wrote when they linked it
mattdesl · 2026-03-08
For those just learning about perceptual colour spaces, I’d recommend exploring OKLab which is simpler to implement and overcomes some of the problems of CIELab.
https://bottosson.github.io/posts/oklab/
ronsor · 2026-01-19
Oklab is a great color space that does what you expect[0] much better than HSL/HSV.
[0] https://bottosson.github.io/posts/oklab/. The better a color space matches human perception, the easier it is to certain processing operations, such as converting to grayscale while preserving the perceived brightness.
ack_complete · 2025-03-15
It's not you or your display, linear color just isn't great for gradients: https://bottosson.github.io/posts/colorwrong/
It can be better than sRGB for the color part of gradients but is awful for the brightness axis. The reason why linear color is so important for operations like blending light, antialiasing, and dithering is also why it is bad where perceptual uniformity is desired. sRGB isn't as good as Oklab or CIELAB perceptually, but a grayscale ramp rendered in linear color is so distorted towards white it's useless. Image formats also encode non-linear color for good reason. "Use linear color everywhere" is overly simplistic and bad advice.
boulos · 2025-01-17
Amy Gooch's Color2Gray and various follow-on work has better coverage of the OP's actual goal:
> evaluate relative brightnesses between art assets, and improve overall game readability
The method in Color2Gray is trying to enhance salience, but the paper does a good job of comparing the problems (including red / blue examples in particular).
Like other commenters, I think oklab would look better than CIELAB on the example given in the OP. https://bottosson.github.io/posts/oklab/#comparison-with-other-color-s… and the Munsell data below it show it to be a lot more uniform than either CIELAB or CIELUV.
itishappy · 2024-07-12
It's a shame the article doesn't go deep enough to encounter perceptual uniformity. In short, the human visual system is strongly non-linear. We perceive more greens than blues or reds. None of the color systems mentioned in the article (including the CIE 1931 chromaticity diagram at the end) are perceptually uniform. The 1976 color spaces (CIELuv and CIELab) were introduced as an attempt to deal with this, and there's been many other attempts since.
My favorite is OKLab:
https://bottosson.github.io/posts/oklab/
turtledragonfly · 2023-11-30
This is a nice article, bringing together various color/perception concepts.
For those interested, you may also like the article introducing the "OK Lab" color space[1] and others by the same author[2].
It's my current favorite, though definitely not perfect.
[1] https://bottosson.github.io/posts/oklab/
[2] https://bottosson.github.io/posts/
yarg · 2022-11-12
Oklab - https://bottosson.github.io/posts/oklab/
The dude's blog has a few more posts about colour in software: https://bottosson.github.io/
The gamut clipping post is quite interesting - https://bottosson.github.io/posts/gamutclipping/
heisenzombie · 2022-05-26
I loved playing with the color pickers here:
https://bottosson.github.io/misc/colorpicker/
As a very-amateur designer, I feel like things I design would be non-trivially impacted by the use of one of these alternative color pickers. Fiddling around with them I felt like I was "discovering" different colors than in the classic HSV pickers.
smagoun · 2022-01-11
This fantastic article proposes new colorspaces (okhsl, oklab) for color pickers and is worth the read for anyone interested in color: https://bottosson.github.io/posts/colorpicker/
Many similar problems to solve as in the gradient generator, but approached from a different point of view, and with some novel ideas.
user-the-name · 2021-09-12
Perceptual colour spaces are basically great if you want to pick an exact colour for the mud you are drawing.
They really, really aren't good for picking useful colours. People don't keep using HSV because they are idiots, and have remained idiots for the last thirty years, they are using HSV because it lets you pick usable colours.
The article goes through a lot of deep, thoughtful work only to arrive at an end result of this: https://bottosson.github.io/img/colorpicker/okhsl_circle.png
A circle of different muds and a little bit of hot pink.
Remnant44 · 2023-05-08
Whenever linear RGB / gamma discussions come up, you know there's going to be a lot of folks going on about how frustrating it is that the default for most apps is to do their blending/filters/etc in gamma space (as TFA does).
And they're right. But there's an entire flip side of this coin, called Linear is Not Always The Answer.
Are you dealing with the behavior of light? Then you should be a linear colorspace.
But if you're performing artistic operations or other things that need to look right to a human, this is not what you want. What you actually want is a perceptually-uniform colorspace. Linear RGB is most definitely _not_ perceptually uniform! It's in fact, much worse than sRGB!
sRGB for all its flaws is at least roughly perceptually uniform for grey tones, a kind of "poor man's perceptual space". Color mixing, gradients, etc etc all work much better in a uniform space.
I've fallen in love with Oklab as a colorspace. (https://bottosson.github.io/posts/oklab/ ), which has in practice provided excellent results.
Light? Use linear rgb. Human vision? Use Oklab.
matthberg · 2022-07-30
This looks fantastic for working with colors, and from a great developer too. A very very similar js library is Culori [0, 1], which I discovered on the original Oklab introduction post [2].
If you're doing generative artwork or any procedural work with a non-fixed palette, a good color library and working in linear or Oklab based colorspace is a must. Using sRGB or HSV/B when interpolating for gradients or generating palettes or complementary colors is extremely painful; a 50% brightness (HSV) yellow is visually much brighter than a 50% brightness purple, with similar issues cropping up for saturation. Balancing the lighting and contrast of programmatically generated colors is so much simpler when you have a perceptually uniform colorspace like OkLCh, or linear RGB if you're working with predefined hex values.
[0]: https://culorijs.org/
[1]: https://github.com/Evercoder/culori
[2]: https://bottosson.github.io/posts/oklab/
jiggawatts · 2021-09-12
The #1 best "Blender tip" (that also applies to computer graphics in general), is that by default it is horribly incorrect with its treatment of colour spaces and especially gamma/tonemapping.
Rather than me clumsily explaining with text how to get this right and have your artwork "pop" with very little effort, watch this video titled "The Secret Ingredient to Photorealism": https://www.youtube.com/watch?v=m9AT7H4GGrA
Combine that with physically correct materials and rendering, and you could literally "sketch" a handful of grey boxes with a single area light and have it nearly pop out of the screen with uncanny realism!
The #2 tip is that chances are that you're probably working with a cheap LCD monitor. Even for $600-$1000 you can get a very decent monitor with DCI-P3 or AdodeRGB wide gamut support and more accurate colour. That helps to produce content that is consistent and correct. That, or invest in a calibrator and set up your operating system colour management with the ICC profile of your panel. Without this, images you grab from Chrome or Firefox will shift in hue and/or brightness when you import them into image editing software. Test your browser with this site: https://cameratico.com/tools/web-browser-color-management-test/
The #3 tip is that you can make much better colour choices working in a perceptual space. The colour pickers in most software use trivial RGB 0..255 ranges mapped to a rectangle. This is garbage, criminally lazy, clownshoes programming.…
127 · 2026-03-08
To people who aren't yet aware also: https://bottosson.github.io/posts/oklab/
djoldman · 2025-08-25
Creator of OKLCH on OKLCH:
https://bottosson.github.io/posts/oklab/
jedimastert · 2025-08-25
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-models%3F
ucarion · 2025-08-25
For others, I'm sure parent knows: OKLCH is largely a bugfix for CILEAB. Both try to make a color space where even steps feel evenly spaced to a human. But CIELAB had procedural flaws in its creation.
See slide 19: https://www.w3.org/Graphics/Color/Workshop/slides/talk/lilley -- if you ask CIELAB to make "pure blue" (RGB 0 0 100%) become grayscale, the intermediate colors become purple to the human eye. The entire point of a perceptual color space is that that doesn't happen. OKLCH fixes that.
BTW, credit to Björn Ottosson, who basically side-projected a color space into the web standards and more: https://bottosson.github.io/posts/oklab/ ... folks like him are why we sometimes have nice things!
dwringer · 2025-08-25
There most definitely is perceptual hue shift in HSL (and HSV); it's illustrated quite well at [0](The blog of the creator of OKLab), particularly in [1], an image showing S and L axes while leaving H fixed.
[0]https://bottosson.github.io/posts/colorpicker/
[1]https://bottosson.github.io/img/colorpicker/hsl_blue.png
eviks · 2025-04-29
It does, that's why the default way to enter should've been at least okHSL and okHSV https://bottosson.github.io/misc/colorpicker/
But the RGB defaults can't be easily reasoned about either, so this is still an improvement, so it's not worse
mkesper · 2025-03-13
Did you try any of the OKlab color space implementations for calculating? https://bottosson.github.io/posts/oklab/
kookamamie · 2025-01-17
See Oklab colorspace for an attempt at fairer perceptual brightness: https://bottosson.github.io/posts/oklab/
CharlesW · 2024-11-22
> Anyone know if that is part of a wider adoption trend or is Tailwind pioneering here?
It's part of a wider adoption trend. https://bottosson.github.io/posts/oklab/#oklab-implementations
zokier · 2024-10-14
I have a feeling that it would be good to these sort of transformations in perceptually uniform colorspace anyways. Ottosson has some examples of color blending in different color spaces: https://bottosson.github.io/posts/colorwrong/#comparisons
myrmidon · 2024-09-05
This ("lightness prediction") is one of the design criteria for the OKLAB color space, see: https://bottosson.github.io/posts/oklab/
The HSV color spectrum in the oklab article shows very clearly how the OKLAB lightness is a much better metric for whether a color is bright or not than HSV-value.
This article by comparison is very grayscale-focussed and concise, but gives less information on the physics behind it.
anon2345252 · 2024-07-26
Oklab is even better.
https://bottosson.github.io/posts/oklab/
promiseofbeans · 2024-02-04
Author's writeup (I am not OP): https://bottosson.github.io/posts/oklab/
kuon · 2024-02-02
HSLuv is integrated into my workflow, so I keep using it, but the OKlab colorspace is very good too.
https://bottosson.github.io/posts/oklab/
rrr_oh_man · 2024-02-02
If anybody was as confused as I about all the plausible-sounding-yet-opaque terms like HSL/HSV, Luminance, etc.:
https://bottosson.github.io/posts/colorpicker/
throwaway290 · 2023-09-12
More to the point from the author of Oklab: https://bottosson.github.io/posts/oklab/
creata · 2023-08-30
In this thread, the author suggests that they'd use Oklab[1] if they were to write the article today. Oklab was introduced in [2].
[1]: https://news.ycombinator.com/item?id=37310534
[2]: https://bottosson.github.io/posts/oklab/