Understanding colors and their codes in the digital world
All those who have worked with image editing software, or simply those who have ever used a program like Photoshop, may have noticed that when selecting or indicating a specific color, for an element of the image that is being edited , the program offers us different formats in which to indicate the color. Each of these formats refer to the different color codes used in the digital world.
In this article we will explain the most used color codes and how they differ from each other.
Let's start by indicating that the most important and most used color codes are the following: RGB, HEX, HSL, HSV, and CMYK.
The RGB color code is based on the use of three base colors to give life to a wide spectrum of colors. RGB stands for Red Green Blue, precisely the three colors on which the RGB code is based (Red, Green and Blue).
The code of a certain color in this RGB format contains a red, green and a blue parameter with a specific value, which is between 0 and 255, and which establishes the intensity of the red, green and blue color.
That said, let's make an example, the red color in RGB code would be indicated as follows rgb(255, 0, 0), where the first number indicates the intensity of the red color (255), the second number the intensity of the color green (0) and the third number indicates the intensity of the color (blue). In this example the resulting color is Red since the parameter with the highest value is the parameter corresponding to the color red, while the other two parameters have zero value added.
A color expressed in hexadecimal code, such as #ff0000 (red color) is a 6-symbol code made up of up to three pairs of 2-symbol elements. Each pair of elements represents a specific color, that is, there is a pair of elements for the color red, one for the color green, and one for the color blue. In turn, each pair of elements expresses the intensity of the color that corresponds to it, and indicates it with a color value from 0 to 255.
If we want to transform a code from RGB to hexadecimal, then the hexadecimal formula will convert each RGB value into a unique 2-digit alphanumeric code. Continuing with the example, the RGB code (255, 0, 0) is E06910 in hex code.
Now, why choose the hexadecimal code to post any other?
In principle, one of the main advantages of hexadecimal codes should be highlighted, which is that it allows more colors to be displayed than even the human eye can appreciate, approximately more than 16 million colors.
On the other hand, hexadecimal encoding is much more practical, since the number of digits for each color will always be six digits, unlike RGB encoding, in which case a color can vary and have up to nine digits. This variation in the number of digits of each color can cause confusion for the user, whereas with hexadecimal encoding this confusion is eliminated, thanks to the fact that the number of digits of each color will always be equal to six.
This color coding is based on three parameters, which are hue, saturation and intensity. Its name is the acronym in English for Hue, Saturation, Lightness.
When indicating a color in HSL code we will do it in the following way: hsl(0, 100%, 50%)
The first value that we will indicate will be the value of the tone, which can range from 0 to 360, and where it is important to remember that 0 represents the red color, 120 represents the green color, and 240 represents the blue color. The second value is a percentage value, and indicates a value from 0% to 100% on a gray scale. The last value is the luminosity, which is also indicated as a percentage, and where 0% is white and 100% is black.
It is very similar to the HSL code, the only difference is that the HSV code uses a different parameter, which is the Value parameter instead of the Lightness value in HSL.
Finally, we have the CMYK color code. This coding is widely used in color printing.
A color in this encoding is written in percentage values, as follows: cmyk(100%, 0%, 0%, 0%)
Each parameter of this CMYK encoding refers to the four ink plates used in some color printing: cyan, magenta, yellow, and key, that is, cyan, magenta, yellow, and black.
In conclusion, we have seen that the most important and most used color codes are RGB, HEX, HSL, HSV, and CMYK. Each color coding is characterized by being based on different parameters. The RGB color code makes use of three base colors (Red, Green and Blue) to bring to life a wide spectrum of colors. HEX is a code that is based on the use of 6 symbols made up of up to three pairs of elements of 2 symbols each. HSL is based on three parameters, which are hue, saturation and intensity. HSV code is very similar to HSL, with the only difference being that it changes one parameter, which is the Value parameter to the Lightness value position in HSL. Finally, we have the CMYK encoding where each parameter refers to the four ink plates used in some color printing: cyan, magenta, yellow, and key, that is, cyan, magenta, yellow, and black.