Next: , Previous: OS/2 Graphics Type, Up: OS/2 Graphics


17.11.2 Color Operations for OS/2 Graphics

These operations control the colors used when drawing on an OS/2 graphics device.

— operation on os2-graphics-device: color?

This operation returns #t if the display supports color.

— operation on os2-graphics-device: set-background-color color-name
— operation on os2-graphics-device: set-foreground-color color-name

These operations change the colors associated with a window. Color-name must be one of the valid color specification forms listed below. set-background-color and set-foreground-color change the colors to be used when drawing, but have no effect on anything drawn prior to their invocation. Because changing the background color affects the entire window, we recommend calling graphics-clear on the window's device afterwards.

The foreground color affects the drawing of text, points, and lines. Colors are specified in one of these ways:

An integer between 0 and #xffffff inclusive
This is the OS/2 internal RGB value.
By name
A limited number of names are understood by the system. Names are strings, e.g. "red", "blue", "black". More names can be registered with the define-color operation.
RGB (Red-Green-Blue) triples
A triple is a list of three integers between 0 and #xff inclusive which specify the intensity of the red, green and blue components of the color. Thus (0 0 0) is black, (0 0 128) is dark blue and (255 255 255) is white.

If the color is not available in the graphics device then the nearest available color is used instead.

— operation on os2-graphics-device: define-color name spec

Define the string name to be the color specified by spec. Spec may be any acceptable color specification. Note that the color names defined this way are available to any OS/2 graphics device, and the names do not have to be defined for each device.

Color names defined by this interface may also be used when setting the colors of the Scheme console window, or the colors of Edwin editor windows.

— operation on os2-graphics-device: find-color name

Looks up a color previously defined by define-color. This returns the color in its most efficient form for operations set-foreground-color or set-background-color.