colour.utils.color_scale¶
- colour.utils.color_scale(begin_hsl: Tuple[float, float, float], end_hsl: Tuple[float, float, float], nb: int) Sequence[Tuple[float, float, float]]¶
Return a list of nb color HSL tuples between begin_hsl and end_hsl.
>>> from colour import color_scale, rgb2hex, hsl2rgb
>>> [rgb2hex(hsl2rgb(hsl)) for hsl in color_scale((0, 1, 0.5), ... (1, 1, 0.5), 3)] ['#f00', '#0f0', '#00f', '#f00']
>>> [rgb2hex(hsl2rgb(hsl)) ... for hsl in color_scale((0, 0, 0), ... (0, 0, 1), ... 15)] ['#000', '#111', '#222', ..., '#ccc', '#ddd', '#eee', '#fff']
Of course, asking for negative values is not supported:
>>> color_scale((0, 1, 0.5), (1, 1, 0.5), -2) Traceback (most recent call last): ... ValueError: Unsupported negative number of colors (nb=-2).