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(val)[source]

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
to(space)[source]

Dynamic caller for to_hsl, to_rgb, etc

to_floats()[source]

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

to_hsl()[source]

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

to_named()[source]

Convert this color to a named color if possible

to_rgb()[source]

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

to_rgba(alpha=1.0)[source]

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