The Official Register of Color Names

Blog

RGB Colors Codes

RGB colors codes

The term RGB is used a lot today because, in the technological area, this color model has been used to determine colors used in monitors, PC components, or as decorative lights. However, this has generated many doubts in people, and they do not know what RGB and its color codes are.

What is RGB?

The acronyms RGB belong to the primary colors: Red, Green, and Blue. The RGB chromatic model consists of combining three different colors, modifying each one’s lighting, and obtaining a new color. Thanks to this model, the monitors, televisions, telephones, cameras, and any screen can display millions of different colors.

On the other hand, the RGB model is based on a model called Additive Color Synthesis. In the mid-nineteenth century, this model was discovered by the Scottish scientist James Clerk Maxwell and consisted of explaining “How to obtain a color by adding different colors with different illumination.”

It is crucial to be aware of which color model is using because there are other models other than RGB based on Additive Color Synthesis or are based on the RGB model.

RGB color model
RGB Color Codes Cube

RGB color codes in programming languages

As we said before, the RGB system works on monitors, TVs, and telephones, but this is because it provides a way to insert a code within the programming language syntax that allows us to choose precisely the RGB values we want.

The code is composed of 3 numbers (0,0,0), each represented by values from 0 to 255, that form a total of 24 bits. The code values written in the order of RGB indicate a specific color:

  • The combination (255,0,0) provides a perfect red;
  • If the combination (0,255,0) is used, green is obtained;
  • The combination (0,0,255) results in blue;
  • And the result of the combination (0,0,0) is black;
  • Finally, if the combination (255,255,255) is used, white is obtained.

Mathematically, these numbers represent a coordinate in a three-dimensional reference frame (X, Y, Z) that has an origin at (0,0,0) and has an endpoint at (255,255,255). This cube that is formed in the 3-dimensional plane is known as “RGB Cube.”

What does the 24 bits mean?

Any monitor or TV screen is made up of hundreds of small points of light called ?pixels,? and each of these pixels has three subpixels that have the colors Red, Gren, and Blue.

On the other hand, a binary bit has a base ?2?, and is raised to the amount indicated by its name; for example, 8 bits = 28. RGB has a total of 24 bits, 8 bits for each letter, 255 colors that can be displayed for each letter, and more than 167,777,216 colors that can be displayed for each pixel used. How is it possible to get such result?

  • (,,)= (255,255,255) = 255*255*255
  • = 777.216 possible combinations.

Many people say ?is 256 and not 255?.This observation is correct, but the only detail is that they are not counting “0” as an option. When translated into programming code, the number of options is reduced to 255, but including 0 as a valid option.

More about RGB color code model you can found there.

RGB color model