HTML - Color Codes
Let's first review the 16 generic color values we mentioned previously before diving into the other, more complicated HTML coloring systems of numeric and hexadecimal values.
HTML String Color Codes
| Black | | Gray | | Silver | | White |
| Yellow | | Lime | | Aqua | | Fuchsia |
| Red | | Green | | Blue | | Purple |
| Maroon | | Olive | | Navy | | Teal |
Any of the string values listed above such as "teal", "black", or "gray" can be passed as a color value to the HTML bgcolor attribute.
HTML Bgcolor Code Values:
bgcolor="purple"
HTML - Colors Numeric (RGB) Values
We do not recommend that you use RGB for safe web design because there are still a handful of internet browsers that do not support numeric color values. However, these values may pop up from time to time, and it is a good idea to have an understanding of how they work.
Colors shown on a computer monitor or any digital device are constructed using various amounts of red, green, and blue light. By blending together different amounts of each color of light, a computer monitor is able to display millions of different colors depending on the quality of the computer monitor. This concept is precisely what HTML numeric (RGB) values use. They specify the amount of each of the different colors of light to blend together (red, green, and blue light).
In a numeric color value the RGB stands for Red, Green, Blue (as in light) and the format for a RGB value is rgb(RED, GREEN, BLUE), just like the name implies. A numeric color value is essentially a comma-separated list of values ranging from 0 (none of that color) to 255 (fully that color) that are interpreted and then mixed together by the web browser and ultimately passed to the computer monitor for display.
Red, Green, and Blue Values
bgcolor="rgb(255,0,0)" | Red |
bgcolor="rgb(0,255,0)" | Green |
bgcolor="rgb(0,0,255)" | Blue |
bgcolor="rgb(0,0,0)" | Black |
bgcolor="rgb(255,255,255)" | White |
bgcolor="rgb(120,120,120)" | Grey |
bgcolor="rgb(240,40,120)" | Pink |
HTML Coloring System - Hexadecimal
The hexadecimal system is complex and difficult to understand at first. Rest assured that the system becomes much, MUCH easier with practice, and as a blossoming web developer, it is critical that you understand hexadecimals to be capable of using them in your own websites. They are far more reliable, and are more widely compatible with web browsers, and are currently the web standard for coloring HTML elements.
HTML Color: Hexadecimal Code:
<!-- Hexadecimal Color Value -->
bgcolor="#004488"