2.3 Drawing Classes
2.3.1 bitmap%
2.3.2 bitmap-dc%
2.3.3 brush%
2.3.4 brush-list%
2.3.5 color%
2.3.6 color-database<%>
2.3.7 dc<%>
2.3.8 dc-path%
2.3.9 font%
2.3.10 font-list%
2.3.11 font-name-directory<%>
2.3.12 gl-config%
2.3.13 gl-context<%>
2.3.14 pen%
2.3.15 pen-list%
2.3.16 point%
2.3.17 post-script-dc%
2.3.18 printer-dc%
2.3.19 ps-setup%
2.3.20 region%
On this page:
blue
copy-from
green
ok?
red
set

color% : class?

  superclass: object%

A color is an object representing a red-green-blue (RGB) combination of primary colors, and is used to determine drawing colors. Each red, green, or blue component of the color is in the range 0 to 255, inclusive. For example, (0, 0, 0) is black, (255, 255, 255) is white, and (255, 0, 0) is red.

See color-database<%> for information about obtaining a color object using a color name.

(make-object color%)  (is-a?/c color%)
(make-object color% red green blue)  (is-a?/c color%)
  red : (integer-in 0 255)
  green : (integer-in 0 255)
  blue : (integer-in 0 255)
(make-object color% color-name)  (is-a?/c color%)
  color-name : string?
Creates a new color with the given RGB values, or matching the given color name (using “black” if no color is given or if the name is not recognized). See color-database<%> for more information on color names.

(send a-color blue)  (integer-in 0 255)
Returns the blue component of the color.

(send a-color copy-from src)  (is-a?/c color%)
  src : (is-a?/c color%)
Copies the RGB values of another color object to this one, returning this object as the result.

(send a-color green)  (integer-in 0 255)
Returns the green component of the color.

(send a-color ok?)  boolean?
Returns #t if the color object is valid.

(send a-color red)  (integer-in 0 255)
Returns the red component of the color.

(send a-color set red green blue)  void?
  red : (integer-in 0 255)
  green : (integer-in 0 255)
  blue : (integer-in 0 255)
Sets the three (red, green, and blue) component values of the color.