colorseq.distinctcolors

class DistinctColors(n=0, h=(0, 1), s=1.0, v=1.0, **kwargs)[source]

Bases: object

Class that allows to generate sequences of distinct colours.

n

number of distinct colours to generate. If not specified then get_colors will return a new generator allowing to draw an undetermined number of values.

Type:int (default=0)
h

determine the spectrum of hues used to generate colours. If a single value is provided then only this hue is used.

Type:float, tuple(float, float) (default=(0, 1))
s

determine the spectrum of saturations used to generate colours. If a single value is provided then only this saturation is used.

Type:float, tuple(float, float) (default=1.0)
v

determine the spectrum of values used to generate colours. If a single value is provided then only this colour value is used.

Type:float, tuple(float, float) (default=1.0)
**kwargs optional parameter
mode: str (default=’gr’)

Determines how to generate the colour sequence. By default, mode='gr', the golden angle is exploited to create a sequence of values in [0, 1] that is relatively evenly distributed.

Todo

Implement a geometric approach.

h_init: float (default=:ref:~.DistinctColor.rd.random)
initial value for the hue.
s_init: float (default=:ref:~.DistinctColor.rd.random)
initial value for the saturation.
v_init: float (default=:ref:~.DistinctColor.rd.random)
initial value for the colour value.
get_colors()[source]
Returns:RGB-colours – If n is set, then a list of colors with this length is returned. If n is unset, i.e. n=0 then a generator is returned allowing to draw new colours continuously.
Return type:list, generator