Converting Colors

Format RGB

The RGB color format or color space, builds the colors from a combination of red, green and blue. Each of these color values defines the intensity of the color as an integer value from 0 to 255.

As RGB is a combination of red, green and blue and each of these can have a value in the range of 0 to 255, it makes 16777216 possible colors. The value 255 stands for 100 percent intensity for the color value, so a RGB color of 0, 255, 0 would be rendered as green.


RGB CSS

To use a RGB color in CSS the following format needs to be used rgb(RED, GREEN, BLUE);. RGB colors are supported by all browsers.

div {
  background-color: rgb(0, 22, 100);
  color: rgb(255, 255, 255);
}