|
Unit 3
custom colors Up to now we have been
limited to the 13 basic colors of java. RGB stands for (red green blue). Every color on the computer is made by some
red, some green and some blue with levels from 0 - 255 For example, red is (255, 0, 0) , green is (0, 255, 0), and blue is (0, 0, 255). Black is (0, 0, 0), and white is (255, 255, 255). Lower numbers produce darker colors, whereas higher numbers produce brighter colors. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Many colors have HTML names attached to them. Here are some of those. The numbers under each name
are needed for us to get that particular color. Continue below the color
swatches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There are two ways that you can use these colors. Copy and run this program. After you have see it. Unblock the /* */ to see how to get shades. We can go brighter and darker easily, but this does not work well with the built-in colors. They may already be as dark or as bright as possible.
There are times when we are using a new color many times. This an optional way to use custom colors It is useful to declare that color as a constant. Add these parts in the appropriate area and try it. 1. Add this to the variable declaration section
2. Add these after the unblocked section
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Assignment
Open
Lab3a3, Open Lab3b3
- remember we are
using this again - make it "nice" |