Commands and Statements

Command SET COLOR Foundation

Defines the default screen colors.

      [ [ <standard>] ;
        [,<enhanced>] ;
        [,<border>] ;
        [,<background>] ;
        [,<unselected>] ;
// or character expression in parentheses:
SET COLOR | COLOUR TO ( <cColor> )
<standard> is a literal color value specifying the default color for the screen display. This color is used with commands like @...PROMPT, @...SAY and ? as well as functions like AChoice(), DbEdit() and MemoEdit().
<enhanced> is a literal color value specifying the color for highlighted display on the screen. The element currently selected is displayed on the screen in this color when several selections are possible. The command MENU TO or the functions DbEdit() and AChoice() provide examples of when a highlight identifies the current position.
<border> is a literal color value specifying the color for the outer border region of the screen. No output is possible in it.
<background> is a literal color value which exists only for compatibility reasons. It is not supported, but can be defined with the function ColorSelect() as a default color.
<unselected> is a literal color value only used for the display of GET entry fields. The active GET is displayed in the color <enhanced> and the other GET entry fields in the color <unselected>.
<cColor> is a character string which must appear in parentheses. It contains a comma separated list of the five system colors.
When SET COLOR TO is called without argument, the command sets the system colors back to the default values "W/N, N/W, N, N, N/W" (see the table below).

The command SET COLOR exists only for compatibility reasons and should no longer be used. Instead, the function SetColor(), which can read or redefine the current color setting, should be used.

The command SET COLOR TO defines the list of automatically supported system colors. The list of system colors consists of a character string containing five color values. They must be separated by commas. A color value consists of a pair of colors for the foreground and background color separated from one another by a slash (/). The following letters can be combined to define a color value:

Color table
Color Color screen Monochrome screen
N | Blank space Black Black
B Blue Underscored
G Green White
BG Cyan White
R Red White
RB Magenta White
GR Brown White
W White White
+ Foreground attribute Foreground attribute
N+ Gray White
B+ Bright blue Bright and underscored
G+ Bright green Bright white
BG+ Bright cyan Bright white
R+ Bright red Bright white
RB+ Bright magenta Bright white
GR+ Yellow Bright white
W+ Bright white Bright white
U Black Underscored
I Inverse Inverse
X Not visible Not visible
* Background attribute Background attribute

The base colors R, G, B, RB, GR, BG, N and W can be modified by an additional color intensity attribute. The plus sign (+) is the attribute for the foreground color and the asterisk (*) raises the intensity of the background color. Both color attributes are recognized regardless of the position they appear in a color value.

The character string containing the default colors is: "W/N, N/W, N, N, N/W". The five color values in the list are used for output in the following situations:

First color value (standard output)

The first color value (standard) is used with most functions and commands which cause screen output. Those are commands like @...SAY, @...PROMPT and ? or functions like AChoice(), MemoEdit() and QOut().

Second color value (highlighted output)

The second color value (highlighted) is used to highlight the active or selected element in a list or group of equal elements. This occurs in functions like AChoice() or DbEdit() and in commands like MENU TO or READ.

Third color value (screen border)

The third color value specifies the color of the screen border. This color can only be set with specific graphic cards.

Fourth color value

The fourth color value is not supported. It can be activated with the function ColorSelect().

Fifth color value (unselected GETs)

The fifth color value specifies the color of entry fields defined using the command @..SAY..GET. The active GET field is highlighted (second color value) and the other GET fields are displayed with the fifth color value. Output of characters following the SAY portion of this command occurs in the default color (first color value).

The Blink attribute, which is set by the character "*", is supported only in full screen text mode.

// In the example, system colors for the colors "default", 
//"highlighted" and "unselected"are defined using SET COLOR. 
// The subsequent display of the SAY expressions occurs in 
// black on cyan, the current GET has the colors bright white 
// on red and the other GET entry fields are displayed bright 
// white on blue. 

   LOCAL cString := "Xbase++" 
   LOCAL dDate   := Date() 
   LOCAL lBoolean:= .F. 
   LOCAL nNumber := 11123.45 
   LOCAL cText   := "A very long character string" 
   LOCAL cColor  := "N/BG,W+/R,,,W+/B" 

   SET COLOR TO ( cColor ) 

   @ 2, 2 SAY "Character value:" GET cString 
   @ 3, 2 SAY "Date value     :" GET dDate 
   @ 4, 2 SAY "Boolean        :" GET lBoolean PICTURE "Y" 
   @ 5, 2 SAY "Number value   :" GET nNumber 
   @ 6, 2 SAY "Scroll         :" GET cText PICTURE "@S10" 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.