I was thinking why color spaces use two numbers to represent color: Lab, HSV, HSL? Is it possible to use one number and have the same or very similar properties when comparing colors as we have for two number color representation.

I read the Wikipedia article about HSL and HSV, it mentions that color spaces were created to account for human vision, but doesn’t answer my question.

Update When asking question I was thinking: well, often we just convert color image into grayscale which is kind of discarding colors or using intensity as color. What we obtain is less memory and cheaper computations when calculating distance between colors of different pixels. The issue here is that some colors when converting to grayscale become indistinguishable gray levels. If we think of gray level as a new "color" and want to enjoy less memory and cheaper computations while still distinguishing "colors" is it possible by redefining color to grayscale transform. Answers suggest that we may not have additivity or similar colors won't be denoted by close numbers. I guess this is the point where we lack dimensions or degrees or freedom.

I'm accepting @Lodinn's answer, because it has two important points for me: 1) reminder that in [somewhat] perceptually uniform namespaces similar colors have similar values (note, that using palette - or indexes - one may also arrange them, so close indexes are close colors); 2) demonstrates the need for another dimension (saturation) from the opposite / by construction. Here one may argue that we may not need a saturation for some tasks and I agree with this argument.

  • 2
    $\begingroup$ //Is it possible to use one number?// It is possible if you're willing to give up on color saturation. I.e. no difference between pale blue and deep blue. $\endgroup$ Dec 23, 2022 at 19:36
  • 3
    $\begingroup$ Note that in all of this, we're talking about human color perception. For dogs (and most other vertebrates) there's only two color receptors, so you could express the whole red-blue color space as luminance and something else (hue, I think, or maybe "woof" or "meow"). For animals with tetrachromatic vision, the projection that's left after you remove the luminence axis would be 3-dimensional, not two. $\endgroup$
    – TimWescott
    Dec 23, 2022 at 21:33
  • 8
    $\begingroup$ Argh -- for dogs and most other mammals there's only two color receptors. most other vertebrates are tetrachromats. There's pretty good evidence that early mammals were nocturnal; the day was dominated by dinosaurs who would have been quite happy to eat little warm tasty mammals. That's consistent with mammals having lost some color vision. Trichromat vision is a recent evolution in primates, with a new green-sensitive rhrodopsin that's a mutation of red-sensitive rhodopsin but not the old fish green-sensitive rhodopsin. $\endgroup$
    – TimWescott
    Dec 23, 2022 at 23:40
  • $\begingroup$ It is not clear to me what the two values are to which you refer. Is it for example the H and S in HSL? Why don’t you count all three? Why don’t you count only H? $\endgroup$
    – Carsten S
    Dec 26, 2022 at 13:09
  • $\begingroup$ Another answer that I think you might find interesting is that the human brain works exactly like that : there's significant evidence (some of which obtained via live monitoring of brain activity) of neuronal pathways that physically separate "RGB" signals from our eyes into 1 luma channel and 2 chroma channels, and these signals form the basis for lowlevel vision of colors. Search for opponent color model for more info. $\endgroup$
    – F.X.
    Dec 26, 2022 at 13:38

6 Answers 6


We already use single numbers... sort of, by cheating. We encoding separate colors serially, as with web colors you may be familiar with in the form #XxYyZz which is generally passed around as a single hexadecimal number. You can even do useful transformations on the whole number (with the help of some 'magic' values).

So why do I say it's cheating? because each pair of hexadecimal digits is actually a separate red, green, or blue channel that is decoded to give instructions to the appropriate subpixel channels on a monitor... you're still using three numbers, you've just packed them into one.

As others have stated, you really can't get below two axes even if you describe light by it's physical wavelength, because you still need to know how much you are receiving to get a rendering of perceived color. If you wanted to cheat like we did above, you could (as a toy example) pack it into a floating point value, where the wavelength (in some arbitrary integer measurement) is multiplied by some common factor (say 2), and the density is encoded as a percentage (again with some arbitrary maximum, and biased on one end to represent 'white'). You will end up with a single number, and you will be able to do useful comparisons and operations on it.

Unfortunately that example comes with the same problems as other systems: you are either stuck with needing multiple values to describe the physical reality (many wavelengths coming from a common source) or you have a single value transformation of those multitudes that describes the perceived reality (which is what most default to). You also have the additional problem that it doesn't interface cleanly with the physical methods we have of reproducing the perception of color.

PS LAB, HSL, and HSV are all actually three value systems, not two. while it might SEEM that one or another value doesn't describe the color, all three are necessary to fully describe the perceived color.

  • 2
    $\begingroup$ “you really can't get below two axes even if you describe light by it's physical wavelength, because you still need to know how much you are receiving to get a rendering of perceived color.” This sentence makes it sound like you think there’s a wavelength for each color? There’s not! The only way to make purple is by combining red and blue light. In any case, you’d need two more numbers, not one, to encode saturation and luminosity. $\endgroup$ Dec 25, 2022 at 14:12
  • $\begingroup$ There IS a physical wavelength for any received light (and intensity), so in the physical scientific sense there is a wavelength for every physical color. Perceived color is different, and overlaps it's extreme ends. But the same conversion we use for other color spaces works here... namely anything that tends past the physical end tends toward the other end in a wrapped fashion. Luminosity was already encoded via density, and saturation via biasing (which is why I chose density to describe it instead of intensity). Mind that it's not supposed to be a good system, just an illustrative example $\endgroup$ Dec 27, 2022 at 3:24
  • $\begingroup$ Just wanted add, the main crux of the problem is is the difference between physical representation, and perceptual representation. In a physical systems luminosity and saturation are effectively the same thing (intensity) for any specific wavelength as "white" does not exist (nor violet actually). Only in perceptual systems do they become separate, with white being a balance of multiple wavelengths across the perceived range (and violet being a balance of the ends). Hence the extra number required to render perceived color, vs physical wavelengths $\endgroup$ Dec 27, 2022 at 3:44
  • $\begingroup$ What is a “physical color”? Color is a perception. It’s a combination of three different responses to light, hence the need for three values to describe color. Light has many wavelengths, you’d need a long series of numbers to describe light in the visible spectrum, it’s never just one frequency, even laser lines have several frequencies very close together. $\endgroup$ Dec 27, 2022 at 3:52
  • $\begingroup$ If you think you can assign a wavelength to each color, then what is the wavelength for brown? $\endgroup$ Dec 27, 2022 at 3:54

Note: also check out the comments for more pointers.

I'll assume that you think of wavelengths, or hue and saturation, which is why you think you could maybe represent color as a single value.

You have to assume the human eye as a model for all of this to make any sense. We have three color-specific photoreceptors, each with a different absorption spectrum. Other animals have two or four, or also three, but maybe with different spectra.

If you don't assume this limited perception, you're now dealing with spectra, which are a lot more natural to work with, but they're not discrete, i.e. not just n-dimensional vectors but continuous functions. A discretization, into bins of whatever bandwidth (50 nm?), would be a practical representation for computers to deal with.

Even a spectrum can't be condensed down to a single color value (dimension). Not without losing information anyway. Say you have something that glows yellow (~580 nm), and something that glows green (~530 nm) and red (~700 nm). To humans, both look the same, if the mix is right, because our photoreceptors are tickled the same way by both lights. These lights are not the same though. Say you have something glowing "white", for whatever notion of white you care to apply... what "color" is that?

Considering the three color-specific photoreceptors in human eyes, the RGB space, having three dimensions, is the most natural. All other color spaces may approximate fancy notions about colors that humans came up with over the millennia.

A simple idea is to separate color from brightness. An RGB tuple of (1,2,3) has the same color appearance as (2,4,6), but the second one is brighter. Such color spaces are presented as planes (2D) containing two color dimensions ("chroma"), with (1D) brightness ("luma") being the third dimension. There is latitude in how to arrange chroma.

You may be thinking of color spaces that have a color dimension, which they call "hue", like HSV or HSL... but they also have a saturation dimension, which differentiates grays from "colors". In that sense, yes, you can represent color as a single value, but you're separating the saturation out from it (as you do the brightness).

The "color wheel" is another fancy human notion that relies on our color perception being "circular". Violet (~400 nm) is a mix of blue (~475 nm) and red (~700 nm), right? Both red and blue have longer wavelengths than violet, so how can that be? It never has anything to do with wavelengths "averaging" or anything. True violet tickles our receptors the same way a combination of red and blue would. Our "red" receptors also react to violet. That is where the linear spectrum is wrapped into a circle.

If you want to dive into "color science", it's a deep rabbit hole. That's the term to look up.

  • 1
    $\begingroup$ Actually, "true", i.e. monochromatic violet (e.g. 410 nm) can't be represented as an RGB triplet, at least if we limit to nonnegative values. Desaturated violets can indeed be represented. $\endgroup$
    – Ruslan
    Dec 24, 2022 at 13:31
  • $\begingroup$ those early experiments... they must have been flabbergasted when they found that they couldn't mix proper violet from other colors and had to mess with the adaptation of the receptors ("numbing" them with overexposure) to "produce" the correct sensation, which involves "negative" responses. $\endgroup$ Dec 24, 2022 at 14:19
  • 1
    $\begingroup$ Re, "something that glows yellow and..." That's got a name, "metamerism" is what they call it when we perceive different spectra as the same color, and metameric failure is what they call it in the color business when different inks/dyes/pigments that look the same color under one light source appear as different colors when illuminated by a different light source. $\endgroup$ Dec 24, 2022 at 20:31
  • 1
    $\begingroup$ common practical examples of that: cheap LED lighting, with poor "CRI" (color reproduction index). it's not approximating the spectrum of black body radiation well enough. it might use some phosphor to turn blue light into a broader spectrum, but the blue still bleeds through... or if it's really bad, it's just the sum of a few narrow bands (R+G+B maybe). some objects may actually be bright (say, orange), but if they don't reflect any of those well, they look dark under that lighting. the opposite can also happen (object's reflection spectrum matches one peak well). it's an eerie effect. $\endgroup$ Dec 24, 2022 at 22:38
  • $\begingroup$ Mr Rackwitz , I have an image processing gig. The budget is 3K USD. It's about detecting defects on an image and doing template marching to find the micro image on the parent image after doing the defect location on the micro image. Are you up for it? $\endgroup$
    – Dong Li
    Dec 8, 2023 at 14:52

Color spaces are represented by three numbers (not two).

That's a direct consequences of the human visual system. Humans have three different type of color receptors in their eyes. Their spectral selectivity corresponds roughly to Red, Green and Blue and hence the RGB color space simply represents how much energy gets to each type of color receptor.

See https://en.wikipedia.org/wiki/Cone_cell

Most other color spaces are transformations of the RGB space to use a more intuitive representation of color.

Is it possible to use one number

Yes. You can simply generate a large table of possible RGB combinations and use the number as an index into the table. Some older computer graphics systems did work this way.

and have the same or very similar properties when comparing colors

No. The table approach loses all context information.

  • 1
    $\begingroup$ The OP is talking about representing color -- Hilmar is talking about the color space -- which is completed by adding luminance. $\endgroup$
    – TimWescott
    Dec 23, 2022 at 21:28
  • 3
    $\begingroup$ Technically, you can think of RGB as one big number (red × 65536 + green × 256 + blue). But that's really just a party trick for squeezing three small (8 bit) numbers into a bigger (24 bit) number. $\endgroup$
    – Kevin
    Dec 24, 2022 at 1:42
  • 3
    $\begingroup$ @robertbristow-johnson if we exclude luminance from the definition of color, we can conclude that brown and orange are the same color. $\endgroup$
    – Ruslan
    Dec 24, 2022 at 13:32
  • 1
    $\begingroup$ @Ruslan Nobody claimed otherwise, you are just playing with the names of the colors. That's like saying dark green and bright green are the same color, when luminance is excluded. $\endgroup$
    – Justme
    Dec 24, 2022 at 19:13
  • 1
    $\begingroup$ @Justme actually, the comment that I replied to above does exactly this: says that two numbers suffice to describe a color. Such a claim effectively renames chromaticity into color and leaves the whole tristimulus value triplet without a name. If we follow it and indeed define color as chromaticity, then there's no distinction between bright and dark green colors. $\endgroup$
    – Ruslan
    Dec 24, 2022 at 21:45

Even if you abstract away the brightness of a light, and leave only the color information, you are left with two coordinates. Take the CIE xyY diagram as an example, where Y represents the brigthness and x and y represent the color.

The most simplest way to explain is might be the fact that standard human photosensors are sensititive to three different ranges of wavelengths, and thus we basically see color as brightness information from three sensor channels, and the color information is based on how the three sensor channels are proportional to each other. A common oversimplification is that the three channels of information are red, green, and blue, but they are not, RGB model can just be used, and any model can be used, as long as it creates an identical receptor stimulus in the eye. Any non-standard human vision model is rarely discussed, as not many are tetrachromats with four types of receptors, and rarely one receptor type is fully missing, as there are various levels of colour blindness.

So you can't represent a color with a single number. In addition to brightness information, you always need two more pieces of information, which basically tell the hue of the color, and how saturated the color is.

There are two neat consequences of this. Purple light does not exist, it is always a sum of red and blue light in some proportion. And white can be achieved with any combination of two suitably selected colors, and if their brightnesses are properly weighted, the sum of two colours cause identical stimulus to the three receptors than white light. That's how white LEDs work, they have a blue LED with yellow phosphorus.

  • $\begingroup$ But what we consider white depends on the environment. There is no absolute white. Our vision adapts, in the same way that we apply white balance to a digital photograph. $\endgroup$ Dec 24, 2022 at 18:34
  • 2
    $\begingroup$ @CrisLuengo Of course, but we are talking about white in specific color space, where also "whites" of different colour temperatures show as different colours. $\endgroup$
    – Justme
    Dec 24, 2022 at 18:56

Hilmar mentions a possibility of transforming the color space into a one-dimensional construct. Indeed, this is possible, but the reason we do not do that is that the way we structure the world has meaning.

Now, to your question:

Is it possible to use one number and have the same or very similar properties when comparing colors as we have for two number color representation.

No. It is impossible to prove a negative with such an open question, but we could employ some considerations. Perceptual ways to model color - say, L*u*v* or even HSL color spaces, - have one important property in common: similar colors are close numerically, while dissimilar are not. Moreover, chromaticities are additive: a linear mixture of two real colors is also a real color, and it is perceptually in between the two original ones. This is a subset of what is known as Grassmann's laws (I actually recommend this read if you're interested in color theory, but, as Cristoph remarks, it is a notorious rabbit hole). This linear mixability and the existence of complementary colors as a corollary (also available at the corresponding Wikipedia page) is key here.

Could this be achieved with just one number? Well, the easiest way to demonstrate the issue is to take two of the primaries (say, blue and red) and consider where the third one would fit on a proposed linear scale. It can't be between them, so it has to be outside. Just like so, we have arrived at hue. So far, so good, but now where do the bleaker versions of the primaries fit in? We could maintain a measure of them being perceptually close like so: hue with interdispersion

But, crucially, additivity will be lost here no matter what we do: one could always pick two bleak colors and end up with a vibrant one in between.

Mixing in bleak colors does not work well

As per Grassmann's laws, bleak colors should be a linear mixture of complementary colors, and the diagram just above violates that. In fact, they should all be somewhere near the middle: this is the reason white point is in the middle of the chromaticity diagram. Any way of representing both hue and saturation in one dimension would break the color mixability.

The core of the issue is that we perceive "closeness" of colors based on more than one factor. Say (26, 107, 230) is close to BOTH (26, 168, 230) and (13, 104, 242) - do also note how RGB is not so great for representing human perception of color! The first transition is not as much greener as it is lighter, which is something apparent when you look at their HSL representations.

Yet another point to make is the pure technical one. Indeed, we could discretize the color space using the transform of, say, C = 65536*R + 256*G + B.

Now, let's say we have a number - I'll use 5717334 (87, 61, 86 RGB) as an example. What happens when we decide to go from 8 bit color representation to 10 bit color representation, shifting the definition accordingly? It becomes (5, 463, 342 RGB 10-bit), which would correspond to a completely different initial color (1, 116, 86 RGB) - not just substantially darker shade. Using the color space that corresponds to underlying biophysical phenomena makes it less implementation specific, and now you can do all kinds of things - chroma subsampling comes to mind - without worrying too much you would have to re-do everything anew when some small part of it changes. With RGB, going from 8-bit to 10-bit is as simple as multiplying values by 4. If you have a single number, having to transform it back to the original representation and back every time you want to alter an implementation detail is a sign the original implementation made more sense.

In other words, all models are wrong, but some are useful. We could use one number or hundreds of numbers - hyperspectral imaging would be one example - but using 2 or 3 components makes the most sense precisely because we humans are built this way. It is not a fundamental property of the physical nature of light, but it is a fundamental psychophysiological property of human color vision.


Brief answer to make a distinction, it's not about X numbers but X degrees of freedom.

We don't need more than one number. All we gain with more is dynamic precision.

Consider RGB, three floats between 0 and 1. Each number can express, let's say, $2^{32}$ variations of the same color. Putting aside whether we can see that many (we can't), we can instead use one float:

$$ \begin{align} & \text{R:} \ 0 \ \text{to} \ 1/3\ \\ & \text{G:} \ 1/3 \ \text{to} \ 2/3\ \\ & \text{B:} \ 2/3 \ \text{to} \ 1\ \end{align} $$ and now, we can express $2^{32}/3$ variations of each color. This works with any mapping, not just RGB.

The choice to use whatever-degrees of freedom is sometimes matter of design to achieve desired properties (e.g. convenience, efficiency), other times because it reflects the true structure (e.g. 3 numbers to describe 3-D space). It's what the other answers describe.


  1. The above RGB example tremendously understates the utility of having three separate numbers, since an arbitrary color is also a combination of R, G, and B.
  2. "Don't need X numbers" can mean more than one thing. Here I am addressing the idea that there's something fundamental or irreducible about the need to use X numbers, in this context. Yet, my arguments can be reused to conclude that X degrees of freedom aren't needed either - that's not my intent.
  • $\begingroup$ in your construction using a single number, how do you represent yellow? how do you represent white? $\endgroup$ Apr 23, 2023 at 13:44
  • $\begingroup$ @ChristophRackwitz Indeed an important point on utility. If it's meant to contest the 1-number entirely, however, my point stands: "any mapping" means any I/O relationship, it's universal. One can make a universal lossless compressor this way, though it'd be useless. $\endgroup$ Apr 23, 2023 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.