10.1.6.1.1. ColorDataBase

Module to implement a colour database.

class Patro.GraphicStyle.Color.ColorDataBase.Color(*args, **kwargs)[source]

Bases: object

Class to define a colour

Usage:

color.red
color.blue
color.green

color.name

# to get a '#rrggbb' string
str(color)

color1 == color2
__STR_FORMAT__ = '#{:02x}{:02x}{:02x}'
__eq__(other)[source]

Return self==value.

__hash__ = None
__init__(*args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

__repr__()[source]

Return repr(self).

__str__()[source]

Return str(self).

_check_value(value)[source]
static _to_float(x)[source]
static _to_int(x)[source]
blue
blue_float
clone()[source]
green
green_float
hls
hsv
name
red
red_float
class Patro.GraphicStyle.Color.ColorDataBase.ColorDataBase[source]

Bases: object

Class to implement a colour database.

The class implements a dictionary API:

color_database['black']
'black' in 'color_database

 for color in color_database:
     pass

We can get a color directly using:

color_database.black
__contains__(name)[source]
__getattr__(name)[source]
__getitem__(name)[source]
__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

__iter__()[source]
__len__()[source]
add(name, color)[source]

Register a Color instance

ensure_color(color)[source]

Ensure color is a Color instance

iter_names()[source]