Share via


COLORREF (Compact 2013)

3/28/2014

This value is a 32-bit value used to specify an RGB color.

Syntax

typedef DWORD COLORREF;
typedef DWORD* LPCOLORREF;

Members

None.

Remarks

When specifying an explicit RGB color, the COLORREF value has the following hexadecimal form.

0xaabbggrr

The low-order byte (rr) contains a value for the relative intensity of red. The second byte (gg) contains a value for green. The third byte (bb) contains a value for blue.

The high-order byte (aa) contains a value for the degree of opacity in the alpha component.

When you want to create a color value that has an alpha component, the high-order byte (aa) can range from 00 (fully transparent) to FF (fully opaque).

When you want to create a color value without an alpha component, the high-order byte (aa) must be zero (00).

The maximum value for a single byte is 0xFF.

To create a COLORREF color value that has an alpha component, use the RGBA macro.

To create a COLORREF color value with no alpha component, use the RGB macro.

To extract the individual values for the red, green, and blue components of a color value, use the GetRValue, GetGValue, and GetBValue macros, respectively.

Requirements

Header

windows.h

See Also

Reference

GDI Structures
GetBValue
GetGValue
GetRValue
RGB
RGBA
SetBkColor