Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 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-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. 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-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version