When selecting system colors, match but don't mix

Raymond Chen

Raymond

Here’s a question that came in from a customer:

Is there a way to view all the Windows color schemes at once? We want to display text in the COLOR_BTNTEXT color against a background of COLOR_INACTIVECAPTION, and we want to check that this looks good in all of the themes.

A mistake I see from some programs is mixing system colors that are not meant to be mixed. The colors I’m talking about are the ones obtained from the GetSysColor function. Here are the text and background color pairs, with a sample of what those colors are on a default install of Windows XP.

TextBackgroundSample
COLOR_WINDOWTEXTCOLOR_WINDOWsample
COLOR_HOTLITECOLOR_WINDOWsample
COLOR_HIGHLIGHTTEXTCOLOR_HIGHLIGHTsample
COLOR_INFOTEXTCOLOR_INFOBKsample
COLOR_MENUTEXTCOLOR_MENUsample
COLOR_BTNTEXTCOLOR_BTNFACEsample
COLOR_CAPTIONTEXTCOLOR_ACTIVECAPTIONsample
COLOR_INACTIVECAPTIONTEXTCOLOR_INACTIVECAPTIONsample

If you’re going to combine colors, and you need them to contrast against each other (for example, because you’re going to draw text with them as the foreground and background colors), choose a pair from one of the rows above. Do not choose colors from different rows because there is no guarantee that they will be readable against each other.
For example, I like to use black on #71FFFF as my color scheme for highlighted text. I’ve seen programs which break the above rule and draw text in the COLOR_HIGHLIGHT color against a background of COLOR_WINDOW, on the assumption that the highlight color contrasts against the window color. (They get away with this in the default Windows XP color scheme because the window color is white and the highlight color is medium blue.) Unfortunately, on my machine, this results in text that is extremely painful on the eyes.
Remember: When it comes to system colors, match. Don’t mix.

Raymond Chen
Raymond Chen

Follow Raymond