RGB

Updated: 02/04/2024 by Computer Hope
Overlapping RGB (red, green, blue) circles to create new colors yellow, magenta, cyan, white, and all other combinations of colors.

Short for red, green, and blue, RGB is a method of creating colors from the colors of red, green, and blue. RGB is sometimes used when describing a display or monitor. The picture shows how this happens in CMYK (cyan, magenta, yellow, and key) as each of the circles overlap other colors to create new colors.

Note

RGB may also be labeled as BGR (blue, green, and red) in many Windows API (application programming interface) functions and shown in hexadecimal. For example, blue would be 0x00FF0000.

Using RGB in HTML and CSS

In HTML (hypertext markup language) or CSS (cascading style sheets) RGB can define the color of text or other objects. Below is an example of how an RGB value for the color red is written HTML using a CSS style.

<p style="color:rgb(255 0 0);">Red text.</p>
Tip

Entering an RGB value in our search opens the color code for the entered value. For example, entering "rgb:255,0,0" or "rgb:255 0 0" would open the red color code page.

What is ARGB and RGBA?

The "A" in ARGB is short for "alpha" and describes the first or last 8-bits in a 32-bit integer that store the alpha (transparency) data. See our color page for further information.

With HTML (hypertext markup language) and CSS (cascading style sheets), the "A" in RGBA is short for "alpha" and describes a fourth parameter that store the transparency value. With this parameter "0" is completely transparent, and "1" is completely opaque. Below is an example of red text with 20% transparency.

<p style="color:rgb(255 0 0 / 20%);">Red text.</p>

Below is an example of the output of the above code. If you're viewing our page in dark mode, this text appears darker, and in light mode, it'll appear lighter because of the background of the text.

Red text.

Note

As you may notice, when adding a transparency to the RGB color code to make it an RGBA, don't separate the values with commas.

CMYK, Color, Color terms, Computer acronyms, HSB, IRGB, Photoshop terms, RGB monitor, Trichromatic, Video terms