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)[źródło]

An object representing a color.

setHex(psHexColor: char) int[źródło]

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[źródło]

Set all four RGBA components. Returns MS_SUCCESS or MS_FAILURE

toHex() char[źródło]

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»