Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

CREATE COLOR SET

This command lets you save a named color set to the resource file. It’s part of the FoxPro for DOS color system, but does work in Visual FoxPro. Since colors are really the user’s domain in a Windows application, and there are simpler ways to handle colors in VFP if you want to break the rules, the only reason to work with this system is to maintain old code.

Usage

CREATE COLOR SET ColorSetName

FoxPro for DOS includes an incredibly complex, yet somehow elegant, scheme for specifying colors for the various visible components of an application. The elegant part is that you have tremendous control over colors. The complex part is the implementation.

A color set consists of 24 color schemes. Each scheme is composed of 10 color pairs and each pair has (surprise) two colors: foreground and background. A color pair can be specified either by specially designated characters (see the list under Colors Overview in Help) or by using a special form of RGB() that accepts six values—the first three are foreground, the last three are background.

In FoxPro for DOS, each element of the user interface is controlled by one of the color schemes. Within the schemes, each color pair is used for certain aspects of those elements. For example, in many schemes, color pair 4 controls active titles while color pair 5 controls inactive titles. Color pairs 1 and 2 usually control disabled and enabled text.

FoxPro for DOS uses only about half of the 24 color schemes for its own interface, leaving the rest available for custom coloring. The whole system, while hard to grasp initially, makes it easy both to stick with standard system colors and to branch out and use other setups.

Naturally, it’s different in Visual FoxPro. The biggest difference is that, instead of the wide range of colors used by the FoxPro for DOS interface, Visual FoxPro (and FoxPro for Windows before it) uses very few colors. Almost everything in the interface is white, black or gray. Even if you choose one of the more outlandish Windows color schemes (in Windows 3.1, “Hot Dog Stand” was always a good choice for seeing what would shake out—the newer Windows versions don’t come with anything quite so loud), you still see lots of black and gray in VFP.

In fact, choosing a different Windows color scheme points out that Visual FoxPro borrows a lot of its colors from Windows. But once you start fiddling (using SET COLOR OF SCHEME), the connection to the Windows colors is broken.

In addition, some aspects of the interface (like the system menu bar) aren’t controlled by FoxPro’s color schemes. No matter how much you try, you just can’t change them.

If all that explanation hasn’t scared you off , you’re ready for CREATE COLOR SET. It’s actually a simple command. It saves the current values for all 24 color schemes to the resource file under a name you specify. As in FoxPro 2.x for Windows, there’s no tool to help you set up the schemes. Use SET COLOR OF SCHEME.

Example

* Save the current set of color schemes in the resource file
CREATE COLOR SET MyFavoriteColors

See Also

ColorSource, RGB(), RGBScheme(), Set Color Of Scheme, Set Color Set, Set Resource