Color Codes
- However, most HTML authors, like to use a more specific color representation using a hexadecimal value for each color.
- Using hexadecimal values make the range of colors that can be selected exponential.
- Color values are based on the theory that any color is a combination of three basic colors: Red, Green and Blue, hence the RGB appreciation.
- In hexadecimal codes we use # followed by two digits for each basic color; so, for example, #FF0000 means Red=FF, Green=00, and Blue=00, hence the resulting color is Red, while #00FF00 if a green color and #0000FF is blue.
- If we want to make a color darker, we lower the value of its two digits; so, #550000 is dark red, and #005500 is dark green.
- A combination of color can be specified, and this is why using this hexadecimal method which provided a very large range of numbering. So, for example; #FFFFFF, means all three colors are selected in full, and that is the definition of the white color, while #000000 is black; #555555 is (dark white), which is gray.
- Hexadecimal values are used through any color picking tool, which can exist in HTML code editors as well as graphic tools; i.e. you pic the color, and the tool gives you the hexadecimal values.
- Many web pages on the net, provides color palettes with hexadecimal values for each.
If we apply this to our previous example, like this:
<!doctype html>
<html>
<body>
<p style="color: #333333">
Any color whatever it be, is a combination of three colors:
</p>
<ul>
<li style="color: #FF0000">Red
</li>
<li style="color: #00FF00">Green
</li>
<li style="color: #0000FF">Blue
</li>
</ul>
</body>
</html>
We get the same result as this:
