RGB Values

You should remember how to set the pen color in LOGO (you use the setpencolor command). It looks like this:
  setpencolor(255 0 0)
This example will make the pencolor RED. If you read the documentation for TurtleTracks LOGO you will see that setpencolor uses RGB values to set the pencolor. RGB stands for Red-Green-Blue.

RGB values are used in a lot of places (including HTML, The GIMP, and in JAVA).

EXERCISE: Start The GIMP. At the bottom of the main tool palette you will see a black box. Double-click on it. The Color Selection dialog box will pop open. On the right side of this dialog you will see several sliders. The bottom three are labeled R, G, and B. (We won't worry about the top three... They are labeled H, S, and V which stand for Hue, Saturation, and Brightness... The B was already used for BLUE down below.) Move these bottom three sliders back and forth. As you move them you will notice several things changing in the dialog. Most importantly notice the HEX TRIPLET in the bottom box. Set the sliders for RGB to 255, 255, and 255. The resulting color will be white and the HEX TRIPLET will read FFFFFF. Set RGB to 255, 0, 0. The resulting HEX TRIPLET will be FF0000. Play around with these sliders for a while and remember how to use this dialog to find HEX TRIPLET values for colors.

Now look at the code for this web page. You will notice that HEX values are used to control the colors of things appearing on this page. Look in the BODY and FONT tags.

JAVA: In JAVA you can set color using a number of ways. Here are a few examples:

    g.setColor(Color.red);
    g.setColor(new Color(255, 0, 0));
    setBackground(Color.green);
There are also a lot of advanced ways of working with color, but these are some of the commands you may see fairly early.

ASSIGNMENT: Make a LOGO image in which you create six filled in blocks across the screen using the following colors: RED, GREEN, BLUE, YELLOW, MAGENTA, and CYAN. Display this image on a web page. Using HEX TRIPLETS set the web page background color to BLACK, the regular text color (which you'll use for the page title) to WHITE, and then position text under each block in your image to be the same color as the image. For instance, under the RED block, write the word RED in the color RED.