12 KiB
| title | chunk | source | category | tags | date_saved | instance |
|---|---|---|---|---|---|---|
| RGB - Glossary | MDN | 1/3 | https://developer.mozilla.org/en-US/docs/Glossary/RGB | reference | web, html, css, javascript, documentation | 2026-05-05T05:41:51.280598+00:00 | kb-cron |
MDN HTML HTML: Markup language
HTML reference
HTML guides
Markup languages
CSS reference
CSS guides
Layout cookbook
JavaScriptJS JavaScript: Scripting language
JS reference
JS guides
Web APIs Web APIs: Programming interfaces
Web API reference
Web API guides
- Using the Web animation API
- Using the Fetch API
- Working with the History API
- Using the Web speech API
- Using web workers
Technologies
Topics
Learn Learn web development
Frontend developer course
- Getting started modules
- Core modules
- MDN Curriculum
- Check out the video course from Scrimba, our partner
Learn HTML
Learn CSS
Learn JavaScript
Tools Discover our tools
About Get to know MDN better
RGB
Red-Green-Blue (RGB) is a color model that represents colors as mixtures of three underlying components (or channels), namely: red , green , and blue. This model describes a color with a sequence of three numbers (typically between 0.0 and 1.0, or between 0 and 255). Each number represents the primary colors' different intensities (or contributions) in determining the final color.
An RGB value by itself has no meaning. It's the color model that defines how the three components interact within a color space to define a color. Graphically, a point in a three-dimensional grid or cube represents a color. Each dimension (or axis) corresponds to a different channel. The RGB color model is then a cubic , or Cartesian , coordinate system of the underlying color space.
For the web, the underlying color space for an RGB value is sRGB (Standard RGB), and each RGB component is a number between 0 and 1.
Note that sRGB is one of several RGB color spaces. Other RGB color spaces, like the Adobe RGB color space, can represent a wider gamut of color than the sRGB color space. The coordinates in sRGB and Adobe RGB are different.
There are many ways to describe the RGB components of a color. In CSS, they can be represented in various ways: in hexadecimal notation as a single 24-bit integer (for example, #add8e6 is light blue) or in functional notation by using rgb() with three percent values or numbers ranging from 0 to 255 (for example, rgb(46 139 87) is green). CSS also supports the srgb, srgb-linear, a98-rgb, and prophoto-rgb color spaces for the color() function.
RGB is not the only color model that can represent the sRGB color space. Cylindrical coordinate systems like the HSL (hue-saturation-lightness) or HWB (hue-whiteness-blackness) color models are also used to represent an sRGB color on the web.
In this article
See also
<color>CSS data type- ColorAide: sRGB color space
- RGB color model on Wikipedia
- sRGB color space on Wikipedia
- Adobe RGB color space on Wikipedia