From RGB to L*a*b* color space (2024)
28 points
by kqr
4 days ago
| 5 comments
| kaizoudou.com
| HN
guidedlight
1 hour ago
[-]
This article describes how to convert from the sRGB color space, not RGB.

sRGB like Lab* is device independent so a transformation between the two is possible.

RGB on the other hand is device dependent, and would therefore require a device ICC Profile to convert to Lab*.

reply
127
28 minutes ago
[-]
To people who aren't yet aware also: https://bottosson.github.io/posts/oklab/
reply
mattdesl
20 minutes ago
[-]
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/

reply
aparadja
13 minutes ago
[-]
If you ever need to generate a gradient between colors in any of your code, interpolating colors in the Lab color space is an awesome option. A simple linear interpolation of the components gives impressively beautiful results.

(Although, like several other commenters, I do recommend OKLab.)

reply
thangalin
1 hour ago
[-]
A practical application is pie charts, apologies for the XSLT:

* https://repo.autonoma.ca/repo/delibero/blob/HEAD/source/xsl/...

* https://repo.autonoma.ca/repo/delibero/blob/HEAD/source/xsl/...

An example pie chart is on page 33, section 9.2.3:

* https://repo.autonoma.ca/repo/delibero/raw/HEAD/docs/manual/...

* https://i.ibb.co/ymDLcPNj/pie-chart.png (screenshot)

The colours are harmonious, visually distinct, and not hard-coded to a fixed number of slices.

reply