HTML colors
The color may be a represented in one of the three ways.
Named colors such as red, green, blue and transparent may be used.
The color may be defined by rgb() function (decimal notaion).
Hexadecimal notaion may also be used such as #RRGGBB.
Color notations
1. Named colors
CSS defines a lot of named colors. These named colors originally come from HTML. And a version of the most colors is obtained from X11 color system.
'Click' on the respective pallet to copy the color code. Use converter to change the color codes from one notation to another.
converter
2. rgb() function - Decimal notation
rgb() function accepts values for the red, green and blue. Each one has minimum value of '0' and maximum value of '255'.
Color | Name | rgb() |
---|---|---|
Black | rgb(0,0,0) | |
Red | rgb(255,0,0) | |
Green | rgb(0,255,0) | |
Blue | rgb(0,0,255) | |
Yellow | rgb(255,255,0) | |
Cyan | rgb(0,255,255) | |
White | rgb(255,255,255) | |
Dimgray | rgb(105,105,105) |
If we set the same values for red, green and blue, it represents gray type color. For example, rgb(200,200,200).
3. #RRGGBB - Hexadecimal notation
The hexadecimal notation of the rgb value consists of '#' character, followed by some number of digits (0-9) or letters (a-f). There might be 6 or 8 digits or letters.
six digits
The three pairs of digits or letters represent red, green and blue colors. For example, #ff0000 is value for red color.
eight digits
There might be eight digits or letters instead of six digits. The fourth pair of digits or letter represents opacity of the object. For example, #ffff0000 is value for yellow color with opacity 0.
Color notation converters
1. Hexadecimal to decimal converter
You can convert hexadecimal value (that consists of 6 letters or digits) to decimal value.
rgb(255,0,255)
2. Decimal to Hexadecimal converter
Put the values of R, G and B to get the value in decimal notation.
#000000
R-
G-
B-
3. RGB value to color converter
Set the values of R, G and B and you'll get the color.
rgb(0,0,0)
R-0
G-0
B-0
Was this article helpful?