Visual FoxPro offers a sophisticated set of commands for full control of colors.
By default, Visual FoxPro takes its colors from the operating system's Control Panel settings. At startup, the Control Panel colors are mapped to the Visual FoxPro default color schemes. You can set colors directly with the SET COLOR commands or interactively in the Control Panel. Refer to your Macintosh documentation for more information about setting colors with the Control Panel.
By default, Visual FoxPro takes its colors from the operating system's Control Panel settings. At startup, the Control Panel colors are mapped to the Visual FoxPro default color schemes. You can set colors directly with the SET COLOR commands or interactively in the Control Panel. Refer to your Windows documentation for more information about setting colors with the Control Panel.
Not all Visual FoxPro interface elements can be controlled by color schemes — for example, system elements such as the Data Session window and Command window, the system menu bar, and so on.
The following color terms are used throughout the FoxPro documentation.
A color pair contains two color codes that specify the foreground and background colors. A color pair consists of a set of two letters separated by a forward slash; the first letter specifying the foreground color and the second letter specifying the background color.
For example, the following color pair specifies a red foreground on a white background:
R/W
The following table lists the available colors and their codes.
Color | Code |
Black | N |
Blank | X |
Blue | B |
Brown | GR |
Cyan | BG |
Green | G |
Inverse | I |
Magenta | RB |
Red | R |
White | W |
Yellow | GR+ |
Underlined | U |
An asterisk (*) placed immediately after a color code can be used to denote blinking or bright (depending on your video hardware and the setting for SET BLINK) for the background color. In Visual FoxPro, including an asterisk makes the background bright rather than blinking. A plus sign (+) placed immediately after a color code can be used to denote high intensity for the foreground color.
On monochrome monitors, only four colors are available: white (W), black (N), underlined (U), and inverse video (I). The blank (X) color is useful for entering passwords.
A color pair can also be specified with a set of six RGB (red, green, and blue) color values separated by commas. These values range from 0 (lowest intensity or no color) to 255 (high intensity or bright color). Each foreground and background color requires three values, one for red, one for green, and one for blue. A color pair, therefore, requires six values, three for the foreground and three for the background.
Here is the RGB color code for red on dark gray (high intensity black):
RGB(255,0,0,64,64,64)
The first three values in the RGB expression above set the foreground color to red and the second three values set the background color to dark gray.
The following is a table of the colors that are available in Visual FoxPro, including the color codes and the corresponding RGB values.
Color | Color code | RGB value |
White | W+ | 255,255,255 |
Black | N | 0,0,0 |
Dark Gray | N+ | 64,64,64 (25% gray) |
Gray | W | 192,192,192 |
Red | R+ | 255,0,0 |
Dark Red | R | 128,0,0 |
Yellow | GR+ | 255,255,0 |
Dark Yellow | GR | 128,128,0 |
Green | G+ | 0,255,0 |
Dark Green | G | 0,128,0 |
Cyan | BG+ | 0,255,255 |
Dark Cyan | BG | 0,128,128 |
Blue | B+ | 0,0,255 |
Dark Blue | B | 0,0,128 |
Magenta | RB+ | 255,0,255 |
Dark Magenta | RB | 128,0,128 |
Blank | X | N/A |
When using RGB values, the following rules determine the color:
A color-pair list consists of one to ten color pairs separated by commas. For example:
W+/B, W+/BG, GR+/B, GR+/B, R+/B, W+/GR, GR+/RB, N+/N, GR+/B, R+/B
A color-pair list for a monochrome monitor might look like this:
W/N, N+/W, W+/N, W+/N, W/N, U+/N, W+/N, -, W+/N, W/N
Color-pair lists for monochrome monitors might have a dash (-) in the eighth color-pair location to indicate that a shadow isn't present.
Color pairs can also be specified as a set of RGB (red, green, and blue) values. A set of RGB color values looks like this:
RGB(0,255,0,255,0,0), RGB(127,255,0,0,0,0), ...
A color scheme is a set of 10 color pairs. Use SCHEME( ) or RGBSCHEME( ) to return the color pairs for a color scheme.
Color schemes control the colors of interface elements such as system windows, user-defined windows, menus, and so on. In Visual FoxPro, the color of some interface elements are not controlled by a color scheme. For example, the colors of the Data Session window and Command window, the system menu bar, and so on cannot be controlled by a color scheme.
In your configuration file, you can specify your own startup color schemes. Include the following line for each color scheme you want to change:
COLOR OF SCHEME nScheme = Colorpairlist
Note In Visual FoxPro, color schemes 13 through 15 are reserved for internal use. In FoxPro for Windows, color schemes 13 and 14 are reserved for internal use. In FoxPro for Macintosh, color schemes 13 through 16 are reserved for internal use. Do not use these color schemes.
A color set consists of 24 color schemes. You can save the complete color environment in a color set. Color sets are not supported in FoxPro for Macintosh.
Color sets, like keyboard macros and memory variables, can be saved for later use. A color set can be saved with CREATE COLOR SET. Color sets are stored in the Foxuser.dbf resource file.
You can load a color set with SET COLOR SET.
When Visual FoxPro is first started, the Control Panel color settings are loaded into the default color set. To specify a startup color set in your configuration file, include the following line:
COLOR SET = ColorSetName