Before i explain how different color attributes can be assigned, let me show a more elaborate example of colors and text.
This is a simple Crosstitch design made clearer by the introduction of colors to the symbols representing the stitches. Although there are only 11 colors presented here. There are actually more possible colors.
Between the quotation marks (") in the font-color attribute<font color="#000000">, there is a space for six characters "#000000",. In the example shown here, the characters between the quote marks are six zeroes. These six digits, form the RGB hexadecimal color code. The first 2 digits is for red, the 3rd and fourth digit for green and the last two digits for blue<font color="000000">. You can replace any of these digits with the numbers 0 to 9 and letters A to F. That's 16 characters per digit. If we would count it, thats 16x16x16x16x16x16 or a total of 16,777,216 combinations. Theoretically, each combination represents a different color. But because some of the differences are so near in shade, there are only 256 identifiable colors in HTML. A certain set of colors, known as "WEB SAFE COLOR PALLETTE" contain only 216 hues. They are called web safe because the colors in this pallette are accurately reproduced. It uses only the digits 00, 33, 66, 99, CC and FF.
Generic color names like Blue, Red, Yellow, Green, Black etc. can be used instead of the RGB code, the draw back is that older browsers do not recognize this command/tag-attribute, aside from being too limited in choices. So the RGB is a better learn and use, specially if you want to specify an exact color.
With a magnifying glass, look at your monitor(or TV screen) when its showing ""white"(do not look too long or when the screen is very bright). You will see three alternating dots(in a colored tv it will be slits) of color - red,green,blue,red,green,blue,red,green,blue and so on. This is what the RGB attribute controls. It specifies the intensity/brightness of each dot, that will lit up to show the text, or line, or background as the case may be.
Lets start with the first two digits. As explained before, this represents Red. there are 16x16 combinations or shall we say intensity/brightness for that color(256 shades of red). the value "0" or zero represents the lowest figure, increasing brightness as we go to 9 and A until we reach F which is the highest value. So "00" or zero-zero is no light, "01" is a very very very dim red and gets brighter as we increase the values peaking in brightness when we reach "FF". This goes the same for the third and fourth digit which is Green. at zero-zero it will be no color and at FF it will be the brightest Green. As is for the Blue, which is digits 5 and 6.
Now for the brain twister. Because the RGB dots in the monitor are sources of light, combining equal intensities of Red, Green and Blue produces white light. Equally lowering the intensity of the Three colors will produce gray and black when all the lights are out(of course!).
They are additive, a direct contrast when you are using pigment (paint, watercolor, ink) which is subtractive in nature.
So saying, equal intensity Red and Green together will produce Yellow. As Red becomes brighter than Green, the color will shift to Orange until it becomes pure Red when the Green is all out. On the opposite, as we diminish the brightness of red and keep the green bright, the color will shift to Yellow-Green until it become pure Green again when the Red is gone.