All Manuals > CAPI User Guide and Reference Manual


15 The Color System

The LispWorks Color System allows you to manipulate colors, which are used as the color values in Graphics Ports and CAPI functions. For example, to draw a string in red, you call:

(gp:draw-string pane string x y :foreground :red)

The value of :foreground (:red above) must be a color specification that is recognized by the Color System (:red is recognized because it is part of the color database that is pre-loaded)..

In the LispWorks Color System, colors can be represented in two ways:

  1. A color spec, which specifies a color model (for example RGB) and the values of the parameters in this model (for example the parameters in RGB would be the values of the red, green and blue components, and optionally the alpha value).
  2. A symbol, normally a keyword. For a symbol to be used a color, it must be associated with a color spec, either directly or via another symbol. Symbols that are used as colors are looked up in a color database. The LispWorks image is supplied with a large color database already loaded (approximately 660 entries), and you can add your own entries using define-color-alias or by loading your own color database.

The LispWorks Color System allows you to:

The Color System symbols are exported from the COLOR package, and all symbols mentioned in this chapter are assumed to be external to this package unless otherwise stated.

15.1 Color specs

15.2 Color aliases

15.3 Color models

15.4 Loading the color database

15.5 Defining new color models

CAPI User Guide and Reference Manual (Windows version) - 3 Aug 2017