The letters (a,b,c,d,e,f) & numbers (0,1,2,3,4,5,6,7,8,9) in the HTML color
tags represent the hexadecimal red - green - blue
values of the color you want for. With the first two characters the red value, the second, the green, & the third, blue.
The first table shows a few of the colors that are supported by name too in the browsers, you can use "black" instead of #000000 for example. (Please note though that different browsers have different opinions on what color a specific colorname really
represents, so use the hexadecimal values if you want to be sure that a color comes out correctly in all browsers.)
BLACK
WHITE
GREEN
MAROON
OLIVE
NAVY
PURPLE
GRAY
|
RED
YELLOW
BLUE
TEAL
LIME
AQUA
FUCHSIA
SILVER
|
How To Calculate The Values
To be able to calculate the value for the color you want you need to know 3 things.
- RGB values for color
- What the RGB values are divided by 16, and what the decimal remainder is multiplied by 16.
- How to convert those three results into the hexadecimal color tag
For this example we will use the color blue.
Step 1 : Get RGB Value
Blue: RGB: 0,0,255: no red (0), no green (0), & full blue (255)
Step 2 : Divide by 16 and multiply decimal remainder by 16
Red Value: 0 / 16 = 0
0 * 16 = 0
Green Value: 0 / 16 = 0
0 * 16 = 0
Blue Value: 255 / 16 = 15.9375
.9375 * 16 = 15
That gives us 0,0 - 0,0 - 15,15
Step 3 : Convert to hexadecimal
| Number | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f |
Result
0 & 0 = 00 - red ("#00 ")
0 & 0 = 00 - green (#0000 ")
15 & 15 = ff - blue (#0000ff")
The result for blue is "#0000ff" as you can see.
| The 16 most basic colors: |
| Color |
Hexadecimal |
RGB |
| . | Red | ff0000 | 255,0,0 |
| . | Maroon | 880000 | 128,0,0 |
| . | Lime | 00ff00 | 0,255,0 |
| . | Green | 008800 | 0,128,0 |
| . | Blue | 0000ff | 0,0,255 |
| . | Aqua | 00ffff | 0,255,255 |
| . | Teal | 008888 | 0,128,128 |
| . | Navy | 000088 | 0,0,128 |
| . | Fuchsia | ff00ff | 255,0,255 |
| . | Purple | 880088 | 128,0,128 |
| . | Silver | cccccc | 192,192,192 |
| . | Gray | 888888 | 128,128,128 |
| . | Black | 000000 | 0,0,0 |
| . | Yellow | ffff00 | 255,255,0 |
| . | Olive | 888800 | 128,128,0 |
| . | White | ffffff | 255,255,255 |
|
|
|