mapscript.colorObj

class mapscript.colorObj(red: int = 0, green: int = 0, blue: int = 0, alpha: int = 255)

An object representing a color.

Attributes

alpha

int Alpha (opacity) component of color in range [0-255]

blue

int Blue component of color in range [0-255]

green

int Green component of color in range [0-255]

red

int Red component of color in range [0-255]

thisown

The membership flag

Methods

__init__(red: int = 0, green: int = 0, blue: int = 0, alpha: int = 255)[burim]

An object representing a color.

setHex(psHexColor: char) int[burim]

Set the color to values specified in case-independent hexadecimal notation. hex must start with a ‹#› followed by three or four hex bytes, e.g. ‹#ffffff› or ‹#ffffffff›. If only three hex bytes are supplied, the alpha will be set to 255. Calling setHex(‹#ffffff›) therefore assigns values of 255 to each color component, including the alpha. Returns MS_SUCCESS or MS_FAILURE

setRGB(red: int, green: int, blue: int, alpha: int = 255) int[burim]

Set all four RGBA components. Returns MS_SUCCESS or MS_FAILURE

toHex() char[burim]

Complement to setHex, returning a hexadecimal representation of the color components. If alpha is 255 then this is three hex bytes ‹#rrggbb›, otherwise four hex bytes ‹#rrggbbaa›