Reputation: 159
Just checked this website http://www.workwithcolor.com/hsl-color-schemer-01.htm and I am curious how to get those numbers in Lum(luminance)? I can not find a proper formula online to get those results. Thanks
Upvotes: 1
Views: 1718
Reputation: 164
A way to get the values they show is transforming the colour from sRGB to CIE-XYZ and then from CIE-XYZ to L*a*b* (or CIELAB)
In CIELAB, L* is described as perceptual lightness, that's the value the page shows as Luminance.
You can calculate this value quickly with the following equations, remember that the RGB values must need to be normalized (values from 0 to 1):
Here is a comparison between this algorithm (L*) and the one in the page (Lum.) using the colours on the color luminance explanation.
Color | L* [%] | Lum. [%] |
---|---|---|
#FF0000 |
53.232881... | 54 (53.77) |
#FF8000 |
67.050096... | 65 (65.06) |
#FFFF00 |
97.138246... | 94 (93.63) |
#80FF00 |
89.910015... | 83 (82.96) |
#00FF00 |
87.737033... | 80 (79.52) |
#00FF80 |
88.485146... | 82 (81.63) |
#00FFFF |
91.116521... | 87 (87.44) |
#0080FF |
54.718662... | 57 (57.36) |
#0000FF |
32.302586... | 44 (43.95) |
#8000FF |
40.911243... | 52 (51.51) |
#FF00FF |
60.319933... | 70 (70.28) |
#FF0080 |
54.884906... | 60 (59.59) |
Upvotes: 1