inkex.colors module

Basic color controls

class inkex.colors.Color(color=None, space='rgb')[source]

Bases: list

An RGB array for the color

_set(index, value, spaces=('rgb', 'rgba'))[source]

Set the color value in place, limits setter to specific color space

property alpha

Append a value to the local list

property blue
property green
property hue
interpolate(other, fraction)[source]

Iterpolate two colours by the given fraction

static iscolor(x, accept_none=False)[source]

Checks if a given value can be parsed as a color

static isnone(x)[source]

Checks if a given color is none

property lightness
static parse_int(color)[source]

Creates an rgb or rgba from a long int

static parse_str(color)[source]

Creates a rgb int array

property red
property saturation

Dynamic caller for to_hsl, to_rgb, etc


Returns the colour values as percentage floats (0.0 - 1.0)


Turn this color into a Hue/Saturation/Lightness colour space


Convert this color to a named color if possible


Turn this color into a Red/Green/Blue colour space


Turn this color isn’t an RGB with Alpha colour space

exception inkex.colors.ColorError[source]

Bases: KeyError

Specific color parsing error

exception inkex.colors.ColorIdError[source]

Bases: inkex.colors.ColorError

Special color error for gradient and color stop ids