CalcuClubCalcuClub Logo

RGB Colors

Table of Contents

What is the RGB Color Model?

The RGB color model is an additive system in which red, green, and blue colors are combined to create a wide range of colors. This model is mainly used in digital displays, such as computer monitors, televisions, and mobile devices.

Additive Color Composition

In the RGB model, each color is represented as a combination of three components: red, green, and blue. Each of these components can vary in intensity from 0 (total absence of light) to 255 (maximum intensity). This means that a color in RGB is represented as a triplet of integers in the range of 0 to 255. For example, rgb(255, 0, 0) represents pure red.

Color Calculation

The final color perceived is the result of adding the intensities of the three primary colors. Here are some examples:

  • White: Achieved when all values are at maximum, i.e., rgb(255, 255, 255).
  • Black: Occurs when all values are zero, i.e., rgb(0, 0, 0).
  • Yellow: Created by combining red and green at their maximum intensities, i.e., rgb(255, 255, 0).
  • Magenta: The result of combining red and blue at their maximum intensities, i.e., rgb(255, 0, 255).
  • Cyan: Formed by combining blue and green at their maximum intensities, i.e., rgb(0, 255, 255).

Relationship with Other Color Models

The RGB model is additive, meaning that colors are generated by adding light. This differentiates it from the CMYK model, which is subtractive and used in printing. In CMYK, colors are created by subtracting light (i.e., adding ink) and are measured in terms of cyan, magenta, yellow, and black.

Conversion to Hexadecimal

RGB colors are often represented in hexadecimal code in the context of web development. Each component (red, green, blue) is converted to a two-digit hexadecimal value and concatenated into a six-digit string. For example, rgb(255, 165, 0) becomes #FFA500, which is the color orange.

Basic Colors in CSS

ColorSampleRGBHexadecimalCSS Name
Whitergb(255, 255, 255)#FFFFFFwhite
Blackrgb(0, 0, 0)#000000black
Redrgb(255, 0, 0)#FF0000red
Greenrgb(0, 255, 0)#00FF00lime
Bluergb(0, 0, 255)#0000FFblue
Yellowrgb(255, 255, 0)#FFFF00yellow
Cyanrgb(0, 255, 255)#00FFFFcyan
Magentargb(255, 0, 255)#FF00FFmagenta
Grayrgb(128, 128, 128)#808080gray

How was this page? Share feedback.