Table of ContentsContents
|
RGB COLORSRed, green and blue are the primary colors in light much like red, yellow and bliue and with paint. Therefore, by mixing various amounts of red, green and blue light we can get any color. The range of how much light of each color you can have is 0-255, so any color can be represented by 3 numbers. The first number is for the amount of red, the second for the amount of green and the last number for the amount of blue. So, 255,0,255 would be all the red and blue you can have and no green so it would be purple. You could potentially need 3 digits for each color.Now let's convert each number between 0 and 255 to base 16 (hexidecimal or hex). This will allow us to express each amount of color with only two digits because base 16 uses less digits to express large numbers. Base 16 needs 16 symbols just like base 10 requires 10 symbols. We use the 10 symbols from base ten, namely the digits 0-9, and then the letters A, B, c, D, E, and F. A=10, B=11, C=12, D=13, E=14, and F=15. The number A5 in base 16 would be 165 in base 10. The 'A' is in the 16's place and the '5' is in the ones place...so we have 10 groups of 16 and 5 ones which is 160 plus 5 which is 165. To convert from base 10 to base 16 divide by 16 to find how many groups of sixteen you have and then the remainder is the number in the ones' place. So, the purple created by 255, 0, 255 in base 16 (or hex) would be FF00FF.
Other common colors are.. When specifying a color in html code we always use RGB color system in hex. The colors have a '#' sign in front of them and quotes around them like this example for setting the font color... <font color="#F4AB56"> ...or like setting the text, background, link, visited link, and active link colors in the body tag... <body text="#FFFFFF" bgcolor="#000000" link="#FF4444" vlink="#FF9999" alink="#99FF99"> ...where the text is white, the background color is black, the link is a light red, the visited link is a lighter red and the active link is a light green.
RGB HEX Values
|