CSS Colors RGB
CSS Colors, RGB Colors

CSS Colors

CSS Colors are used in fonts color and background colors. Font color can be changed by using css "color" Property, background color is changed using "background-color" property and border color is changed using "border-color" property.

CSS Supports RGB Colors and HSL Colors. RGB and HSL are basically Screen Colors. However for printing purpose, we use CMYK (not allowed in css).

Type of CSS Colors

  1. Color Name
  2. RGB Colors
  3. Hexadecimal Color code

CSS Color Names

CSS include total 16,777,216 ( 1 Crore 67 Lakhs ) or 16 Million colours.
However 17 colors are known by their name. These popular colors are

CSS Colors by color name

Color Red

Color Blue

Color Green

Color yellow


<p style="color:red"> Color Red </p>
<p style="color:blue"> Color Blue </p>
<p style="color:green"> Color Green </p>
<p style="color:yellow"> Color Yellow </p>

RGB Color Code

RGB Colors are mainly combination of Red, Green, Blue colors ranging from 0-255.

In RGB colors, we write a color using its value which lies between 0 and 255, or 0%-100%. 0 or 0% is minimum value and 255 or 100% is maximum value. In 0-255, 16 million colors can be used. But in 0%-100%, 1 million colors can be used.

RGB Colors
Color NameRGB Code( in numbers)RGB Code( in %)
RedRGB(255,0,0)RGB(100%,0%,0%)
GreenRGB(0,255,0)RGB(0%,100%,0%)
BlueRGB(0,0,255)RGB(0%,0%,100%)
BlackRGB(0,0,0)RGB(0%,0%,0%)
WhiteRGB(255,255,255)RGB(100%,100%,100%)
CyanRGB(0,255,255)RGB(0%,100%,100%)
MagentaRGB(255,0,255)RGB(100%,0%,100%)
yellowRGB(255,255,0)RGB(100%,100%,0%)

RGB Colors by name

Color Red

Color Green

Color Blue

Color Yellow

Color Magenta

Color Cyan

Color Black

Color White


<p style="color:rgb(255,0,0)"> Color Red </p>
<p style="color:rgb(0,255,0)"> Color Green </p>
<p style="color:rgb(0,0,255)"> Color Blue </p>
<p style="color:rgb(255,255,0)"> Color Yellow </p>
<p style="color:rgb(255,0,255)"> Color Magenta </p>
<p style="color:rgb(0,255,255)"> Color Cyan </p>
<p style="color:rgb(0,0,0)"> Color Black </p>
<p style="color:rgb(255,255,255)"> Color White </p>
		

Hexadecimal Color Code

Hexadecimals colors are basically rgb colors is short form. RGB Colors took 12-16 characters, but Hexadecimals colors takes just 3 or 6 characters followed by #.

Hexadecimal is basically a 16 base number system where we use 16 different values and mix them to write a color code.

In Hexadecimal color coding, we use:

0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f.

Minimum value is 0, and maximum is f.

Color code in Hexadecimal

#RRGGBB;   or   #RGB;

There are total six or three places in Hexadecimal colors. In 6 place, First two represent red, next two represents green and last two represents blue color followed by #. While in 3 place, first is red, second is green, and third is blue, followed by #.

Hexadecimal Colors
Color NameHexa CodeHexa in short
Red#FF0000#F00
Green#00FF00#0F0
Blue#0000FF#00F
Black#000000#000
White#FFFFFF#FFF
Cyan#00FFFF#0FF
Magenta#FF00FF#F0F
yellow#FFFF00#FF0

Hexa Colors Example

Color Red

Color Green

Color Blue

Color Yellow

Color Magenta

Color Cyan

Color Black

Color White


<p style="color:#ff0000"> Color Red </p>
<p style="color:#00ff00"> Color Green </p>
<p style="color:#0000ff"> Color Blue </p>
<p style="color:#ff0000"> Color Yellow </p>
<p style="color:#ff00ff"> Color Magenta </p>
<p style="color:#00ffff"> Color Cyan </p>
<p style="color:#000000"> Color Black </p>
<p style="color:#ffffff"> Color White </p>    
		


True Web Colors / Web Safe Colors

Earlier, when color monitors based on 8-bit color graphics were popular, designers used only few major colors so that similar colors could be identified easily. The reason was CRT were based on light projection phenomenon. We can't view all colors on a CRT based Monitors.

However High Resolution, HD, FHD and Ratina Based LCDs/LEDs use 24 bit (True Tone) or 32 bit colors

There are total 216 colors in true web or Web Safe colors..

True Web Colors are written in hexa code, but only three place with values 0, 3, 6, 9, c, f

True Web Colors or Web Safe colors list


CSS Color Picker

CSS Color Picker to check RGB and hexadecimal colors.

CSS Color Picker

Hexa Color Code: #

RGB Color Code:

This color picker will not work on Touch based devices, like smartphones and tablet


For CSS3 RGBA, HSL and HSLA colors, click below

RGBA HSL and HSLA colors