Next: DrawClear and Flip Up: Viewport Graphics Previous: Position Operations

# Color Operations

A color can be represented in three ways: as a color index (an integer in 0 to 299, inclusive), as a color name string, or as a `rgb` value. All drawing functions which take a color argument accept colors in any form. An `rgb` value is assigned to an index with `change-color`.

- `(make-rgb red green blue)`
  Takes three values in the range 0 (dark) to 1 (bright) and returns an `rgb` (a color).
- `(rgb-red color)
  (rgb-blue color)
  (rgb-green color)`
  Return the red, green, and blue components, respectively, of a color.
- `(rgb? v)`
  Reports whether v is a color.
- `(change-color index rgb)`
  Changes the color at index in the color table to the color specified in rgb. Only the first twenty-one indices are initialized; a color index should not be used until it has been initialized.
- `(default-display-is-color?)`
  Returns `#t` if the default display screen for viewports is in color or `#f` otherwise.