Set Color Set, Set Color Of Scheme, Scheme(), RGBScheme(), Set Color Of, Set Color To

These commands and functions all relate to old ways of setting colors. The first four are all part of the elaborate coloring system designed for FoxPro/DOS. See CREATE COLOR SET for an explanation of that system.SET COLOR OF and SET COLOR TO date back even before the FP/DOS color system and are totally obsolete. Don't use them. They'll just get you in trouble.

Usage

SET COLOR SET TO [ ColorSetName ]
This command loads the named color set from the resource file and puts it into effect. Before you can use it, you need to have created a color set (with CREATE COLOR SET).

Usage

SET COLOR OF SCHEME nScheme TO 
       [ ColorPairList | SCHEME nSourceScheme ]
cColorPairList = SCHEME( nScheme [, nColorPair ] )
cRGBColorList = RGBSCHEME( nScheme [, nColorPair ] )

Parameter

Value

Meaning

nScheme

Numeric

A color scheme number from 1 to 24.

ColorPairList

List of color pairs

A comma-delimited list of up to 10 color pairs to use for the specified scheme.

nSourceScheme

Numeric

A color scheme number from 1 to 24 whose colors should be copied to the specified scheme.

nColorPair

Numeric

Which color pair should be returned?

Omitted

Return the entire list of color pairs.

cColorPairList

Character

A list of 10 color pairs plus a shadow indicator.

cRGBColorList

Character

A list of 10 RGB color pairs plus a shadow indicator.


A color scheme is a set of 10 color pairs used for some aspect of the FoxPro interface. FoxPro has 24 color schemes, of which we're allowed to change 20 or so—a group of schemes in the middle is reserved (in VFP 3, it's 13 to 16; in VFP 5 and later, it's 13 to 15). In FoxPro for DOS, there was wide variation from one color scheme to the next. In Windows, by default, the differences are small. Using the Windows default colors, most color schemes contain black, white and an assortment of grays, with maybe the occasional blue thrown in.There are two ways to indicate colors in FoxPro. The modern Windows way is by using the RGB color definitions. (See RGB() for details.) The traditional Fox way uses a set of letters and symbols in which, for example, blue is represented by "B", black by "N" and yellow by "GR+". Not exactly intuitive—we've never managed to learn these and don't plan to now.SET COLOR OF SCHEME lets you change the colors assigned to a particular scheme. You can either make the scheme exactly match another color scheme or you can specify all 10 color pairs, either in RGB format or using the old letter system. The RGB format used in this command is different than anywhere else in FoxPro—instead of three numbers inside the RGB() function, you put six. The first three are the foreground and the last three are the background. This way, a single RGB() gives a color pair rather than a single color.SCHEME() and RGBSCHEME() let you find out what colors are assigned to a particular scheme. You can return the entire list or a single color pair. No matter which format you choose, after the 10 color pairs, you see an extra comma followed by either "+" or "-". (Actually, in Visual FoxPro, we've only ever seen the "+".) That last character indicates whether objects using that color scheme cast a shadow or not. Since nothing casts a shadow in Visual FoxPro for Windows, you can safely ignore this value.Color handling in Visual FoxPro (and in FoxPro 2.x for Windows) is significantly more trouble than in FoxPro for DOS with its complex, but powerful, colorset mechanism. You can use the DOS system in Visual FoxPro, but setting colors at the application level detaches those colors from the Windows colors, so they don't change when the user changes Windows color schemes. This is clearly a violation of the Windows Interface Guidelines. On the whole, your best bet in VFP is to totally ignore colors and color schemes and rely on the user to set appropriate colors at the Windows level. Doing anything else tells the user that his opinion doesn't count.

Example

SET COLOR SET TO MyColors  && Previously saved
? SCHEME(1)                && Return colors for scheme 1
? RGBSCHEME(4,3)           && Return 3rd color pair of scheme 4
* Copy colors from scheme 10 to scheme 7
SET COLOR OF SCHEME 7 TO SCHEME 10

See Also

BackColor, ColorSource, Create Color Set, ForeColor, RGB(), Set


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .