Skip to content

Latest commit

 

History

History
579 lines (498 loc) · 19.4 KB

nf-winuser-getsyscolor.md

File metadata and controls

579 lines (498 loc) · 19.4 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:winuser.GetSysColor
GetSysColor function (winuser.h)
Retrieves the current color of the specified display element.
COLOR_3DDKSHADOW
COLOR_3DFACE
COLOR_3DHIGHLIGHT
COLOR_3DHILIGHT
COLOR_3DLIGHT
COLOR_3DSHADOW
COLOR_ACTIVEBORDER
COLOR_ACTIVECAPTION
COLOR_APPWORKSPACE
COLOR_BACKGROUND
COLOR_BTNFACE
COLOR_BTNHIGHLIGHT
COLOR_BTNHILIGHT
COLOR_BTNSHADOW
COLOR_BTNTEXT
COLOR_CAPTIONTEXT
COLOR_DESKTOP
COLOR_GRADIENTACTIVECAPTION
COLOR_GRADIENTINACTIVECAPTION
COLOR_GRAYTEXT
COLOR_HIGHLIGHT
COLOR_HIGHLIGHTTEXT
COLOR_HOTLIGHT
COLOR_INACTIVEBORDER
COLOR_INACTIVECAPTION
COLOR_INACTIVECAPTIONTEXT
COLOR_INFOBK
COLOR_INFOTEXT
COLOR_MENU
COLOR_MENUBAR
COLOR_MENUHILIGHT
COLOR_MENUTEXT
COLOR_SCROLLBAR
COLOR_WINDOW
COLOR_WINDOWFRAME
COLOR_WINDOWTEXT
GetSysColor
GetSysColor function [Windows and Messages]
_win32_getsyscolor
base.getsyscolor
winmsg.getsyscolor
winui.getsyscolor
winuser/GetSysColor
winmsg\getsyscolor.htm
winmsg
165c1781-161e-4ab2-98c9-eec4e9098d09
12/05/2018
COLOR_3DDKSHADOW, COLOR_3DFACE, COLOR_3DHIGHLIGHT, COLOR_3DHILIGHT, COLOR_3DLIGHT, COLOR_3DSHADOW, COLOR_ACTIVEBORDER, COLOR_ACTIVECAPTION, COLOR_APPWORKSPACE, COLOR_BACKGROUND, COLOR_BTNFACE, COLOR_BTNHIGHLIGHT, COLOR_BTNHILIGHT, COLOR_BTNSHADOW, COLOR_BTNTEXT, COLOR_CAPTIONTEXT, COLOR_DESKTOP, COLOR_GRADIENTACTIVECAPTION, COLOR_GRADIENTINACTIVECAPTION, COLOR_GRAYTEXT, COLOR_HIGHLIGHT, COLOR_HIGHLIGHTTEXT, COLOR_HOTLIGHT, COLOR_INACTIVEBORDER, COLOR_INACTIVECAPTION, COLOR_INACTIVECAPTIONTEXT, COLOR_INFOBK, COLOR_INFOTEXT, COLOR_MENU, COLOR_MENUBAR, COLOR_MENUHILIGHT, COLOR_MENUTEXT, COLOR_SCROLLBAR, COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWTEXT, GetSysColor, GetSysColor function [Windows and Messages], _win32_getsyscolor, base.getsyscolor, winmsg.getsyscolor, winui.getsyscolor, winuser/GetSysColor
winuser.h
Windows.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
User32.lib
User32.dll
Windows
19H1
GetSysColor
winuser/GetSysColor
c++
APIRef
kbSyntax
DllExport
User32.dll
Ext-MS-Win-RTCore-NTUser-syscolors-l1-1-0.dll
minuser.dll
api-ms-win-ntuser-ie-window-l1-1-0.dll
ie_shims.dll
ext-ms-win-rtcore-ntuser-sysparams-l1-1-0.dll
Ext-MS-Win-NTUser-SysParaMS-Ext-L1-1-0.dll
GetSysColor

GetSysColor function

-description

Retrieves the current color of the specified display element. Display elements are the parts of a window and the display that appear on the system display screen.

-parameters

-param nIndex [in]

Type: int

The display element whose color is to be retrieved. This parameter can be one of the following values.

Value Meaning
COLOR_3DDKSHADOW
21
Dark shadow for three-dimensional display elements.

Windows 10 or greater: This value is not supported.

COLOR_3DFACE
15
Face color for three-dimensional display elements and for dialog box backgrounds.
COLOR_3DHIGHLIGHT
20
Highlight color for three-dimensional display elements (for edges facing the light source.)

Windows 10 or greater: This value is not supported.

COLOR_3DHILIGHT
20
Highlight color for three-dimensional display elements (for edges facing the light source.)

Windows 10 or greater: This value is not supported.

COLOR_3DLIGHT
22
Light color for three-dimensional display elements (for edges facing the light source.)

Windows 10 or greater: This value is not supported.

COLOR_3DSHADOW
16
Shadow color for three-dimensional display elements (for edges facing away from the light source).

Windows 10 or greater: This value is not supported.

COLOR_ACTIVEBORDER
10
Active window border.

Windows 10 or greater: This value is not supported.

COLOR_ACTIVECAPTION
2
Active window title bar.

The associated foreground color is COLOR_CAPTIONTEXT.

Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.

Windows 10 or greater: This value is not supported.

COLOR_APPWORKSPACE
12
Background color of multiple document interface (MDI) applications.

Windows 10 or greater: This value is not supported.

COLOR_BACKGROUND
1
Desktop.

Windows 10 or greater: This value is not supported.

COLOR_BTNFACE
15
Face color for three-dimensional display elements and for dialog box backgrounds. The associated foreground color is COLOR_BTNTEXT.

Windows 10 or greater: This value is not supported.

COLOR_BTNHIGHLIGHT
20
Highlight color for three-dimensional display elements (for edges facing the light source.)

Windows 10 or greater: This value is not supported.

COLOR_BTNHILIGHT
20
Highlight color for three-dimensional display elements (for edges facing the light source.)

Windows 10 or greater: This value is not supported.

COLOR_BTNSHADOW
16
Shadow color for three-dimensional display elements (for edges facing away from the light source).

Windows 10 or greater: This value is not supported.

COLOR_BTNTEXT
18
Text on push buttons. The associated background color is COLOR_BTNFACE.
COLOR_CAPTIONTEXT
9
Text in caption, size box, and scroll bar arrow box. The associated background color is COLOR_ACTIVECAPTION.

Windows 10 or greater: This value is not supported.

COLOR_DESKTOP
1
Desktop.

Windows 10 or greater: This value is not supported.

COLOR_GRADIENTACTIVECAPTION
27
Right side color in the color gradient of an active window's title bar. COLOR_ACTIVECAPTION specifies the left side color. Use SPI_GETGRADIENTCAPTIONS with the SystemParametersInfo function to determine whether the gradient effect is enabled.

Windows 10 or greater: This value is not supported.

COLOR_GRADIENTINACTIVECAPTION
28
Right side color in the color gradient of an inactive window's title bar. COLOR_INACTIVECAPTION specifies the left side color.

Windows 10 or greater: This value is not supported.

COLOR_GRAYTEXT
17
Grayed (disabled) text. This color is set to 0 if the current display driver does not support a solid gray color.
COLOR_HIGHLIGHT
13
Item(s) selected in a control. The associated foreground color is COLOR_HIGHLIGHTTEXT.
COLOR_HIGHLIGHTTEXT
14
Text of item(s) selected in a control. The associated background color is COLOR_HIGHLIGHT.
COLOR_HOTLIGHT
26
Color for a hyperlink or hot-tracked item. The associated background color is COLOR_WINDOW.
COLOR_INACTIVEBORDER
11
Inactive window border.

Windows 10 or greater: This value is not supported.

COLOR_INACTIVECAPTION
3
Inactive window caption.

The associated foreground color is COLOR_INACTIVECAPTIONTEXT.

Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.

Windows 10 or greater: This value is not supported.

COLOR_INACTIVECAPTIONTEXT
19
Color of text in an inactive caption. The associated background color is COLOR_INACTIVECAPTION.

Windows 10 or greater: This value is not supported.

COLOR_INFOBK
24
Background color for tooltip controls. The associated foreground color is COLOR_INFOTEXT.

Windows 10 or greater: This value is not supported.

COLOR_INFOTEXT
23
Text color for tooltip controls. The associated background color is COLOR_INFOBK.

Windows 10 or greater: This value is not supported.

COLOR_MENU
4
Menu background. The associated foreground color is COLOR_MENUTEXT.

Windows 10 or greater: This value is not supported.

COLOR_MENUHILIGHT
29
The color used to highlight menu items when the menu appears as a flat menu (see SystemParametersInfo). The highlighted menu item is outlined with COLOR_HIGHLIGHT.

Windows 2000, Windows 10 or greater:  This value is not supported.

COLOR_MENUBAR
30
The background color for the menu bar when menus appear as flat menus (see SystemParametersInfo). However, COLOR_MENU continues to specify the background color of the menu popup.

Windows 2000, Windows 10 or greater:  This value is not supported.

COLOR_MENUTEXT
7
Text in menus. The associated background color is COLOR_MENU.

Windows 10 or greater: This value is not supported.

COLOR_SCROLLBAR
0
Scroll bar gray area.

Windows 10 or greater: This value is not supported.

COLOR_WINDOW
5
Window background. The associated foreground colors are COLOR_WINDOWTEXT and COLOR_HOTLITE.
COLOR_WINDOWFRAME
6
Window frame.

Windows 10 or greater: This value is not supported.

COLOR_WINDOWTEXT
8
Text in windows. The associated background color is COLOR_WINDOW.

-returns

Type: DWORD

The function returns the red, green, blue (RGB) color value of the given element.

If the nIndex parameter is out of range, the return value is zero. Because zero is also a valid RGB value, you cannot use GetSysColor to determine whether a system color is supported by the current platform. Instead, use the GetSysColorBrush function, which returns NULL if the color is not supported.

-remarks

To display the component of the RGB value, use the GetRValue, GetGValue, and GetBValue macros.

System colors for monochrome displays are usually interpreted as shades of gray.

To paint with a system color brush, an application should use GetSysColorBrush(nIndex), instead of CreateSolidBrush(GetSysColor(nIndex)), because GetSysColorBrush returns a cached brush, instead of allocating a new one.

Color is an important visual element of most user interfaces. For guidelines about using color in your applications, see Color - Win32 and Color in Windows 11.

Windows 10/11 system colors

This table shows the values that are supported in Windows 10 and Windows 11 with color values from the Windows 11 Aquatic contrast theme.

Color swatch Description
:::image type="icon" source="images/sys-color/aquatic-color-window.png"::: COLOR_WINDOW
Background of pages, panes, popups, and windows.

Pair with COLOR_WINDOWTEXT
:::image type="icon" source="images/sys-color/aquatic-color-windowtext.png"::: COLOR_WINDOWTEXT
Headings, body copy, lists, placeholder text, app and window borders, any UI that can't be interacted with.

Pair with COLOR_WINDOW
:::image type="icon" source="images/sys-color/aquatic-color-hotlight.png"::: COLOR_HOTLIGHT
Hyperlinks.

Pair with COLOR_WINDOW
:::image type="icon" source="images/sys-color/aquatic-color-graytext.png"::: COLOR_GRAYTEXT
Inactive (disabled) UI.

Pair with COLOR_WINDOW
:::image type="icon" source="images/sys-color/aquatic-color-highlighttext.png"::: COLOR_HIGHLIGHTTEXT
Foreground color for text or UI that is in selected, interacted with (hover, pressed), or in progress.

Pair with COLOR_HIGHLIGHT
:::image type="icon" source="images/sys-color/aquatic-color-highlight.png"::: COLOR_HIGHLIGHT
Background or accent color for UI that is in selected, interacted with (hover, pressed), or in progress.

Pair with COLOR_HIGHLIGHTTEXT
:::image type="icon" source="images/sys-color/aquatic-color-btntext.png"::: COLOR_BTNTEXT
Foreground color for buttons and any UI that can be interacted with.

Pair with COLOR_3DFACE
:::image type="icon" source="images/sys-color/aquatic-color-3dface.png"::: COLOR_3DFACE
Background color for buttons and any UI that can be interacted with.

Pair with COLOR_BTNTEXT

These images show how the colors appear when used on a background set to COLOR_WINDOW.

Example Values
:::image type="content" source="images/sys-color/aquatic-example-windowtext.png" alt-text="A window with text using the window text color." border="false"::: COLOR_WINDOWTEXT
:::image type="content" source="images/sys-color/aquatic-example-hotlight.png" alt-text="A window with hyperlink text using the hot light color." border="false"::: COLOR_HOTLIGHT
:::image type="content" source="images/sys-color/aquatic-example-graytext.png" alt-text="A window with inactive text using the gray text color." border="false"::: COLOR_GRAYTEXT
:::image type="content" source="images/sys-color/aquatic-example-highlighttext+highlight.png" alt-text="A window with text using the highlight text color on the highlight color." border="false"::: COLOR_HIGHLIGHTTEXT + HIGHLIGHT
:::image type="content" source="images/sys-color/aquatic-example-btntext+3dface.png" alt-text="A window with a button using the 3d face color and button text using the button text color." border="false"::: COLOR_BTNTEXT + COLOR_3DFACE

Examples

For an example, see SetSysColors.

-see-also

CreateSolidBrush

GetSysColorBrush

SetSysColors

SystemParametersInfo