colors module

class colors.RGB(red, green, blue)

Bases: RGB

Represents a color as an RGB (red green blue) value

Create new instance of RGB(red, green, blue)

alphaValue: int = 255
classmethod fromDisplayModelFormatColor_t(c: int) RGB

factory method to create an RGB from a DisplayModelFormatColor_t Color format is 4 bytes: 0xTTbbggrr TT bit flags, only bit 1 used: set for transparent. Encoding alpha in TT was considered (eg 0xFFbbggrr for opaque), but this would break compatibility with code that continues to pass 0x00bbggrr for opaque, all usages would need to be fixed.

classmethod fromCOLORREF(c: c_ulong | int) RGB

factory method to create an RGB from a COLORREF ctypes instance COLORREF format is 4 bytes: 0x00bbggrr According to MSDN, COLORREF high order byte must be zero. Handling of int is kept to maintain backwards compatibility.

_re_RGBFunctionString = re.compile('rgb\\(\\s*(\\d+%?)\\s*,\\s*(\\d+%?)\\s*,\\s*(\\d+%?)\\s*\\)', re.IGNORECASE)
_re_RGBAFunctionString = re.compile('rgba\\(\\s*(\\d+%?)\\s*,\\s*(\\d+%?)\\s*,\\s*(\\d+%?)\\s*,\\s*\\d+(\\.\\d+)?\\s*\\)', re.IGNORECASE)
static _RGBStringValToInt(s)
classmethod fromString(s)

Factory method to create an RGB instance from a css RGB string representation.

toCOLORREF() c_ulong

Returns a COLORREF ctypes instance

toGDIPlusARGB(alpha: int = 255) int

Creates a GDI+ compatible ARGB color, using the specified alpha for the alpha component. @param alpha: The alpha part of the ARGB color,

0 is fully transparent and 255 is fully opaque. Defaults to 255 (opaque).

@type alpha: int

property name
colors._calcColorName(red: int, green: int, blue: int, alpha: int, reportTransparent: bool)