Home Segments Top Top Previous Next

739: Sidetrip

You can create your own Color instances via the three-parameter Color constructor. The three arguments specify the intensity of red, green, and blue in the color, on a scale that ranges from 0 to 255. In the following example, the Color constructor produces a Color instance corresponding to dark blue.

          *-- Red intensity 
          |  *-- Green intensity 
          |  |   *-- Blue intensity 
          v  v   v 
new Color(0, 0, 100) 

To create an instance corresponding to black, you evaluate new Color(0, 0, 0). Similarly, to create an instance corresponding to white, you evaluate new Color(255, 255, 255).