System Colors

Windows maintains 19 system colors for painting various parts of the display. You can obtain and set these colors using GetSysColor and SetSysColor. Identifiers defined in WINDOWS.H specify the system color. Setting a system color with SetSysColor changes it only for the current Windows session.

You can set system colors for future Windows sessions using the Windows Control Panel program. You can also modify the [colors] section in the WIN.INI file. The [colors] section uses keywords for the 19 system colors (different from the GetSysColor and SetSysColor identifiers) followed by red, green, and blue values that can range from 0 to 255. The following table shows how the 19 system colors are identified using the WINDOWS.H identifiers for GetSysColor and SetSysColor, the WIN.INI keywords, and the Control Panel terms:

GetSysColor & SetSysColor WIN.INI Control Panel

COLOR_SCROLLBAR Scrollbar Scroll Bars
COLOR_BACKGROUND Background Desktop Background
COLOR_ACTIVECAPTION ActiveTitle Active Title Bar
COLOR_INACTIVECAPTION InactiveTitle Inactive Title Bar
COLOR_MENU Menu Menu Bar
COLOR_WINDOW Window Window Background
COLOR_WINDOWFRAME WindowFrame Window Frame
COLOR_MENUTEXT MenuText Menu Text
COLOR_WINDOWTEXT WindowText Window Text
COLOR_CAPTIONTEXT TitleText Title Bar Text
COLOR_ACTIVEBORDER ActiveBorder Active Border
COLOR_INACTIVEBORDER InactiveBorder Inactive Border
COLOR_APPWORKSPACE AppWorkspace Application Workspace
COLOR_HIGHLIGHT Highlight  
COLOR_HIGHLIGHTTEXT HighlightText  
COLOR_BTNFACE ButtonFace  
COLOR_BTNSHADOW ButtonShadow  
COLOR_GRAYTEXT GrayText  
COLOR_BTNTEXT ButtonText  

Most of these are self-explanatory. COLOR_BACKGROUND is the color of the desktop area behind all the windows. The COLOR_WINDOWFRAME color is the color used for lines drawn between many of the sections of the display, such as between a menu and a client area. The last six system colors cannot be changed from the Control Panel: The two ”Highlight“ colors involve selected options in menus and list boxes. The last four system colors determine the colors used in push buttons.

Default values for these 19 colors are provided by the display driver. Windows uses these default values unless they are overriden by the [colors] section of WIN.INI.