Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version

## foreground-color

Arguments: standard-object

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-item`s, `button-info`s (of a `multi-picture-button`), and `outline-item`s (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`. `nil` means 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.

In earlier releases, this generic function had an optional argument, result-rgb, which was already deprecated and unused. Starting in release 7.0, that argument is no longer supported. Code which includes that argument will signal an error. The error can be fixed by removing any reference to a second, optional argument.

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-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version