Computer Screen Colors1 Colors Colors can be made of mixtures of 3 primary colors. If the medium is...
-
Upload
rebecca-warren -
Category
Documents
-
view
212 -
download
0
Transcript of Computer Screen Colors1 Colors Colors can be made of mixtures of 3 primary colors. If the medium is...
Computer Screen Colors 1
Colors
• Colors can be made of mixtures of 3 primary colors.
• If the medium is illumination (like on the face of a CRT) the colors are often called Red, Green and Blue.
• If the medium is absorption (like paint or ink) the colors are often called Magenta, Yellow and Cyan (what some of us call red, yellow and blue).
• In the Analog world, the saturation range can be very smooth.
Computer Screen Colors 2
Digital Colors
• In digital systems (for example in computer screens) there is a stepwise range of saturation for each of the 3 colors.
• Many modern systems allow for 256 levels of saturation ranging from 0 (black) to 255 (brightest) for each of the three colors.
• This can not be demonstrated in black and white print but running the program “colors.exe” in the class directory allows you to examine it.
Computer Screen Colors 3
Digital Colors
• This illustrates the appearance of an orange colored plate with a blue saturation of 0, a green saturation of 152/256 and a red saturation of 250/256
• With 256 shades of each of 2 colors, a total of 16,777,216 different colors are available. This color is color #39162.
Computer Screen Colors 4
Digital Colors
• A better understanding can be achieved if we look at the color numbers as binary values.
• The binary system is the basis of the numbers and symbols used in a computer.
• Binary numbers have just two values (0,1) and computer switches and logic gates also have two values (on,off)
Computer Screen Colors 5
Binary & Hexadecimal Numbers
Dec. 8 4 2 1 Hex.
• 0 0 0 0 0 0• 1 0 0 0 1 1• 2 0 0 1 0 2• 3 0 0 1 1 3• 4 0 1 0 0 4• 5 0 1 0 1 5• 6 0 1 1 0 6• 7 0 1 1 1 7
Dec. 8 4 2 1 Hex. • 8 1 0 0 0 8• 9 1 0 0 1 9• 10 1 0 1 0 A• 11 1 0 1 1 B• 12 1 1 0 0 C• 13 1 1 0 1 D• 14 1 1 1 0 E• 15 1 1 1 1 F
Computer Screen Colors 6
Decimal and Hexadecimal
• The color to the right, DarkCyan, is made up of 139 parts of blue and 126 parts of green.
• In Hex those numbers are 8B and 7E.
• In binary they are 10001011 and 01111110.
• This is color number 9,141,760 decimal or 8B7E00 hexadecimal.
Computer Screen Colors 7
A Binary Exercise
• The binary number 10001011 base 2 is identical to 139 base 10.
• In the decimal world, the number 139 can be written as:
1 X 100 = 100 3 X 10 = 30 9 X 1 = + 9 Total 139
• In the binary world the same procedure yields:
1 x 128 = 128 0 x 64 = 0 0 x 32 = 0 0 x 16 = 0 1 x 8 = 8 0 x 4 = 0 1 x 2 = 2 1 x 1 = + 1 Total = 139
Computer Screen Colors 8
A Hexadecimal Exercise
• In the binary world the number 139 works out:
1 x 128 = 128 0 x 64 = 0 0 x 32 = 0 0 x 16 = 0 1 x 8 = 8 0 x 4 = 0 1 x 2 = 2 1 x 1 = + 1 Total = 139
• In the hexadecimal world, the number 8B yields:
8 x 16 = 128B or 11 x 1 = +11 Total = 139
Computer Screen Colors 9
The Number of a Color
• Thus the color whose decimal number is 9,141,760 has a hexadecimal number of 8B7E00.
• It is nearly impossible to determine the color from the decimal number but easy from the hexadecimal number.
Computer Screen Colors 10
Coding Color into Visual Basic
• In the hexadecimal world the decimal equivalent to 8B7E00 is:
8 8 x 1048576 = 8388608 B 11 x 65536 = 720896 7 7 x 4096 = 28672 E 14 x 256 = 3584 0 0 x 16 = 0 0 0 x 1 = + 0 Total = 9141760
Computer Screen Colors 11
Coding Color into Visual Basic
You can use these numbers in your programs. A line of code in Visual Basic like:
Label1.BackColor = 9141760
or:
Label1.BackColor = &H8B7E00
will make the background of Label1 DarkCyan.
Computer Screen Colors 12
The Internet and Color
• The Internet uses a different format for colors.
• Rather than the Blue-Green-Red that Visual Basic uses, the Internet uses Red-Green-Blue.
• So color 8B7E00 hex or 9,141,760 dec in Visual Basic becomes color 007E8B hex or 32,395 dec on the Internet.
• The problem is handled internally, you will see no problem.