Colors

Color Names

With CSS, colors can be set by using color names. CSS supports 140 standard color names.

RGB (Red, Green, Blue)

With HTML, RGB color values can be specified using this formula: rgb(red, green, blue)

Each parameter (red, green, and blue) defines the intensity of the color between 0 and 255.

For example, rgb(255,0,0) is displayed as red, because red is set to its highest value (255) and the others are set to 0.

Shades of gray are often defined using equal values for all the 3 light sources.

Hexadecimal Colors

With HTML, RGB values can also be specified using hexadecimal color values in the form: #RRGGBB, where RR (red), GG (green) and BB (blue) are hexadecimal values between 00 and FF (same as decimal 0-255).

For example, #FF0000 is displayed as red, because red is set to its highest value (FF) and the others are set to the lowest value (00).

Shades of gray are often defined using equal values for all the 3 light sources.