Skip to main content

Color Class

Package: GHIElectronics.Endpoint.Drawing
Module: GHIElectronics.Endpoint.Drawing

A 32-bit color with 8 bits each of alpha, red, green, blue. Canvas maps it to its PixelFormat at draw time.

class Color: ...

Constructors​

Color(r, g, b, a=0xFF)​

def __init__(self, r: int, g: int, b: int, a: int = 0xFF):

Properties​

R​

R: int

Red component, 0..255.

G​

G: int

Green component, 0..255.

B​

B: int

Blue component, 0..255.

A​

A: int

Alpha, 0 (transparent) .. 255 (opaque). Only Argb8888 canvases use it.

Methods​

FromArgb(argb)​

@staticmethod
def FromArgb(argb: int) -> Color:

Color from a 0xAARRGGBB value.

FromRgb(rgb)​

@staticmethod
def FromRgb(rgb: int) -> Color:

Color from a 0xRRGGBB value, opaque.

Named Colors​

Class-level attributes. Names match System.Drawing / CSS where they overlap.

NameValue
Transparent0x00000000
Black0x000000
White0xFFFFFF
Red0xFF0000
Green0x00FF00
Blue0x0000FF
Yellow0xFFFF00
Cyan0x00FFFF
Magenta0xFF00FF
Navy0x000080
Maroon0x800000
Olive0x808000
Gray0x808080
Silver0xC0C0C0
Orange0xFFA500