Generic FunctionPackage: common-graphicsToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 6.2
Significantly revised from 6.1

foreground-color

Arguments: standard-object &optional result-rgb

Returns the foreground color for standard-object if one has been specified for it, and otherwise returns nil. (By contrast, effective-foreground-color will always return a color, by calling default-foreground-color when foreground-color returns nil.)

The foreground-color is the color in which graphics will be drawn and text will be written on the argument object, by calling functions such as draw-line, fill-box, draw-string-in-box, or print. By contrast, background-color is the color used to "erase" the object's drawing area. foreground-color and background-color apply to windows, dialog-items, button-infos (of a multi-picture-button), and outline-items (of an outline).

A foreground color may be specified either by calling (setf foreground-color) or by passing the foreground-color initarg to make-instance or make-window when creating the object. The value may be either an RGB instance (see make-rgb) or nil. nilmeans to use the default-foreground-color for the object. (In particular, the value cannot be an HLS color, as returned by make-hls. If you use HLS colors, apply hls-to-rgb to them before setting this property, and call rgb-to-hls to get the HLS equivalent of an RGB value.)

It is typical to leave the foreground-color of an object nil. In that case, the default-foreground-color is used. If the initial method of that generic function is used, default-foreground-color will return a system color such as the one returned by system-foreground-color. This causes your application to use the end user's preferred colors that they have selected in the Windows Control Panel.

When the foreground-color is an RGB color, the actual RGB instance that is passed to (setf foreground-color) is retained to be returned later by foreground-color. Therefore, applications should not modify an RGB instance while it is assigned to an object. A single RGB instance may be assigned to any number of objects, however.

The optional result-rgb argument is no longer used, and is retained only for compatibility with older Common Graphics application code. This argument was used through version 6.1 to avoid consing the returned RGB instance; now the RGB instance that was specified for the object is instead retained and returned without ever consing a copy.

See also with-foreground-color, a convenient macro that temporarily changes the foreground color while a body of code is executed. See also background-color.


Copyright (c) 1998-2002, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 6.2. This page has had significant revisions compared to the 6.1 page.
Created 2002.2.26.

ToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 6.2
Significantly revised from 6.1