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.
Alone an RGB value has no meaning. A color model defines how the three components relate to a color space. 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 255. Float values are supported.
Note that there are other RGB color spaces, like the Adobe RGB color space, that 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 as a single 24-bit integer in hexadecimal notation (for example,
#add8e6 is light blue), or in functional notation,
rgb() as three separate floats between 0 and 255 (for example,
rgb(46 139.5 87)). In OpenGL, WebGL, and GLSL the red-green-blue components are fractions (floating-point numbers between 0.0 and 1.0), although in the actual color buffer they are typically stored as 8-bit integers.
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 a sRGB color on the web.