So far, you’ve created simple shapes that have been white but appear slightly shaded because of the light source. You’ll now learn how to apply a color to your shapes. Once again, start by opening the file “cone” that we created earlier. The EntityColor command allows you to apply color to an object. Here we will give our cone a color:
; This is the code for creating and coloring the cone cone=CreateCone() PositionEntity cone,0,0,5 EntityColor cone, 125,201,190
After you enter the code EntityColor, you enter the name of the entity you want to color—in this case, it is called cone. You’ll then notice three numbers—in this case, 125,201,190—which represent the red, green, and blue values. In this case, the 125 would be the red value, 201 would be the green value, and 190 would be the blue value. The colors on your computer monitor are created by mixing different values of red, green, and blue. By entering the three values for red, green, and blue (commonly referred to as RGB), you are telling what mix of colors you want to use to color your shape.
Now the million-dollar question: How do you know what combination of red, green, and blue make up a specific color? In others words, if you entered 12, 123, 204, what color would you get? Or if you wanted to color an object purple, what numbers would you enter? Well, almost every major graphics program provides a method for you to enter an RGB value to see the resulting color or select a color and get the RGB values.
Corel PHOTO-PAINT, which is included on the accompanying CD, provides an excellent way to get RGB values. After you launch PHOTO-PAINT, follow these instructions to get your RGB values:
After opening a new document, press Ctrl+F2 on the keyboard. The Color docker (see Figure 5.16) will open on the right side of the screen, and by default, it will be set to RGB mode. You now have several options. You can enter specific values for R, G, and B and see the result of the values in a preview box. You can also click and drag the sliders to manipulate the RGB values.
If you prefer to select a color and then see what the RGB value is, you can click on the Show Color Palettes button, which will show you a square of color palettes. You can scroll through the colors and click on the swatch that you like, and the RGB values will be displayed as seen in Figure 5.17.
18.226.34.205