For many of us, the colors a computer screen makes are of secondary importance: we would much rather have the screen adjust for the conditions — a bit less blue in the evening, a bit more brightness when it’s sunny — and have a crisp resolution. If the color is about right…it's good enough. For many professionals though, from photographers, to film producers, to Data Scientists, color can become an exacting and important field of study.
For a little backstory on color in general it is important to define why it’s so complex and how creating a perfect digital representation for it can be such a difficult problem. On a fundamental physical level, “color” simply represents the wavelength of light. For example, what we commonly call “visible wavelength” ranges from about 400 to 700 nanometers (nm) . However, what we colloquially call “color” and what we identify as “colors” is a far less clear-cut distinction, bridging perceptive, socio-cultural, and linguistic boundaries.
For one, “color” isn’t just about the incoming wavelength of light, it’s also about how much the object in question reflects, transmits, and otherwise alters that light before it hits the color-detecting cone cells at the back of our eye. Then, comes the even tougher part: our eyes have to take that information and encode it into neural signals that our brain can decipher. How it does this can entirely change what colors we perceive and when we perceive them, and more importantly allows the human eye to distinguish up to 10 million distinct “colors.” However, what we call a particular color, for instance “red” “blue” and “yellow” and if we distinguish these categories as being truly different is a far less clear-cut concept. For example, many Russian speakers will distinguish what are simply called “light blue” and “dark blue” in English as fundamentally different colors . The linguistic origins of color categories are a deeply studied and fascinating phenomena which could encompass entire blog posts by themselves. Now, with an introduction to the complexities of color and color perception out of the way, we can delve into how colors are represented on a computer.
On a computer, color data must always do one particular thing: tell the screen to produce a a particular color within some particular constraints. If the screen can only produce 250 colors, the command must select one of those 250. How we determine which of those values to select, and at what brightness is the domain of color science. First, we can explore a classic and probably familiar idea of such a colorspace: RGB.
In an RGB color-space, color data is encoded directly into the fundamental way in which a typical LED display creates colors: it overlaps different intensities of Red, Green, and Blue (RGB) light to create one additive color. By telling the computer what R, G, B intensities to select for each pixel, we can create an image. In standard displays, each RGB value can take a number in the range from [0, 255], with higher being brighter. This allows for the production of over 16 million colors! With this system, we can theoretically display more colors than the human eye can distinguish: so why try anything else? Well, while RGB is straightforward, commonly-used, and useful from a programming perspective, it can’t solve every problem.
For one, the RGB values themselves are dependent on the limits of hardware: exactly what intensity of R, G, and B depends on the computer, and for this reason the colorspace is often standardized to sRGB . In this colorspace, the colors the screen outputs for specific intensities of R, G, and B are standardized and calibrated based on a known function called a transfer function. While this can help standardize the colors a computer screen outputs, it still leaves one issue: the RGB system is fundamentally additive, meaning we must intuit how R, G, and B are being combined in order to produce a real “color.”
One method that gets around such an additive system, and which may be more useful for artists and photographers, is known as Hue, Saturation, and Value, or HSV. This system breaks perceived color into 3 dimensions: Hue, which is what color the object seems to be; Saturation, which is how “colorful” an object appears as; Value, which is how “light or dark” a color appears. While it appears to be more conceptual than RGB, it has at least one useful application for image data analysis: it can be applied for computational image analysis.
One issue with RGB colorspaces is that they do not always work when trying to perform edge or object detection in an image. This is because RGB values very with the amount of light in an image, and designing a filter or finding an object that has shadows or different lighting over it can therefore be quite difficult. In an HSV space however, one can simply focus on Hue, as it is a variable which will be much less dependent on the amount of light hitting a region . What this means, effectively, is that converting an image into HSV can offer far better computational results even if directly interpreting a color in terms of its HSV values may be more unfamiliar to the non artists, photographers, and color scientists among us.
HSV, however, is not without its issues: while discussing the merits and attributes of various color systems, Brewer (1999) writes: “Likewise, hue and lightness are confounded so, for example, a saturated yellow and saturated blue may be designated as the same ‘lightness’ but have wide differences in perceived lightness. These flaws make the systems difficult to use to control the look of a color scheme in a systematic manner.” In other words, certain parameters of the HSV colorspace can have uncertain, and unpredictable attributes when changed, and more importantly, can make it hard to decide on what a color will appear. The same attribute that allows for quick computational analysis can be a drawback for designing an interface or color scheme digestible by humans.
Hopefully this short introduction to the world of color, colorspaces, and their applications has been interesting and informative! I certainly enjoyed learning about the perceptual and linguistic origins of “human” color and how these definitions can intersect and augment how we represent color in computers. If you are interested in delving deeper this wikipedia page (https://en.wikipedia.org/wiki/List_of_color_spaces_and_their_uses) offers a long list of different colorspaces and their uses.
 "Seeing the blues"Nature. News. 2007-04-30.