Mobile app version of vmapp.org
Login or Join
Frith110

: Does hue/sat/lum offer a smaller range of colors than RGB? All values of RGB should be unique and distinguishable, meaning there are truly 256*256*256 colors. In HSL, however, if L=0 then H

@Frith110

Posted in: #Color #ColorConversion #Hsb #Rgb

All values of RGB should be unique and distinguishable, meaning there are truly 256*256*256 colors.

In HSL, however, if L=0 then H and S can be anything, but you still get the same color (black). Similarly, if S=0 then H doesn't matter, as you'll get some shade of pure grey. So it seems that the HSL model offers at best 256*256*256 - 256*256 - 256 colors, or ~0.4% less colors. Is this true?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Frith110

2 Comments

Sorted by latest first Latest Oldest Best

 

@Merenda852

HSL (hue, saturation, lightness) and HSB are derivative color models of the RGB color model. They cover the same range (as in gamut) of colors with a smaller amount of "distinctive" points in between.

The RGB model defines 256^3 or 16,777,216 points
and HSL/HSB define 360*101*101 or 3,672,360 points.

You would have to find out programmatically how many points from HSL map to unique points of RGB. Not only the extreme points you mention map to a single set of RGB values. For example, there are also many dublicates for a saturation value of 1% (in HSL) as you can check here.

That's the theory. In practice still most devices are not capable of processing/presenting 16.777.216 "unique and distinguishable" colors and the human eye can't as well. So in practice the difference of the amount of "distinctive" values often (not always) doesn't matter.

10% popularity Vote Up Vote Down


 

@Ravi4787994

Yes and no.

Yes:

It offers a smaller range of colors assuming that integers are required for each value. Photoshop, for example, requires HSB values to be integer and will yell at you if you try otherwise:



However, your math seems to be off. You're on the right track with RGB: each value can be an integer from 0-255, so the RGB gamut consists of 256³ or 16,581,375 colors.

For HSL, the value constraints are different. H can be 0-359, S can be 0-100, and B can be 0-100. So the number of unique HSL triplets is 360*101*101, or 3,672,360. This does not yet take into account duplicate colors and we're already significantly smaller than RGB.

I am not good enough at statistics to calculate the number of unique values for integer-based HSL, so I won't even try

As a result, there is going to be color collision. You can try this yourself by checking the value of two very close RGB values. For example, #00AAAA and #00AAAB are both converted to 180°, 100%, 67% in Photoshop:



No:

Illustrator is a bit more laid back. It is happy and willing to accept decimal values for HSB:



CSS3 also accepts decimal values for hsl() and hsla(). This implementation makes it way more granular than RGB, which should never accept decimal values.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme