|
CogSci 3 |
Introduction to Computing | ||||||||||||||||||||
|
RGB Background Color Workbench(Uses JavaScript and requires Netscape 3.0 or Internet Explorer 4.0 or higher)
RGB ValuesBinary numbers are what computers use internally to represent numbers. The binary number system is based on 2 (or powers of 2) rather than the normal decimal numbers that we normally use which are based on 10. Each digit in a binary number is either a 0 or 1, and is stored as a single "bit" in the computer. Occasionally when programming a computer, it is convenient to specify the value that each bit in a number will have. However, binary numbers tend to be very long (many digits). For instance, 10000001 is the same as 129 in decimal! Enter hexadecimal. Hexadecimal is a number system based on 16, and is a more compact way to express a binary number. Each hexadecimal digit represents 4 bits, or a binary number between 0 and 15 (decimal). The first 10 digits are written 0-9 just as in normal decimal. The rest of the digits (which represent values from 10-15) are written with the letters A-F, with A equal 10 decimal and F equal 15. If you would like to learn a little more about binary and hexadecimal, visit cg3.binary.html on the same server and directory as this document. In the RGB value that BGCOLOR uses, there are 2 hexadecimal digits representing each of red, green, blue. That is, there are 8 bits, or one byte per color value. For example: <BODY BGCOLOR="#rrggbb">The "rr" represents one byte, as do the "gg" and "bb". Each byte (2 hex digits) is a hexadecimal number between 0 and FF (which is 255 decimal). The higher the color value, the brighter that component of the color will be. What To DoThe values you select will be displayed in the other numeric formats, so you can see the differences in the number systems. You will, of course, have to use hexadecimal values in your <BODY> tag. Note: your eyes will probably not be able to detect small changes in values. That is, changing the red value from 128 to 127 (decimal) will probably not be very apparent. So use large differences when you are first tinkering. When you are close to a color you like, then you can use smaller changes in value to home in on your color. Perhaps as a way to get started, try using the hexadecimal format and values of f0 and see if you can create a "yellow". Terms to Know
©opyright 1997-2004 Mark R. Wallen
|