The background of function can be applied to regions only, except sense regions. The value returned is the integer value of the color associated with the background of the specified region.
The foreground of function can be applied to any object except sense regions, dialog boxes, and controls. When applied to regions, the value returned is the integer associated with the specified region's foreground color; when applied to keys, the value returned is the integer value associated with the specified key's color. For example, if you defined a graphical region as follows:
white graphical region Bulletin size 40 50
at position 10 20
red foreground
and then later specify in your program:
response to Mute
make Labels color background of Bulletin
make Labels foreground color foreground of Bulletin
ESL returns the integer value 7 in response to the background of Bulletin inquiry, making the background color of Labels white, and returns the integer value 1 in response to the foreground of Bulletin inquiry, making the foreground color of Labels red.
Caution: Do not enclose the foreground of or background of functions in parentheses. The following syntax produces compile-time errors with the "(" flagged:
make REGION color (background of REGION2)
If you are inquiring about a textual region, you can use the background at and foreground at functions to find the background and foreground colors of a specified column and line in the textual region. (See Using the foreground at and background at Object Inquiry Built-in Functions.)