Color mapping

This section describe the objects provided to map reals to colors.

Fractal_colormap objects are usually defined through the GUI interface (which import them from a picture, and also export them to a python human-readable input source code).

For convenience, a few template colomaps are provided (blue and orange-brown tones), see the full list under Colormaps: available templates.

class fractalshades.colors.Fractal_colormap(colors: ~fractalshades.colors.color_mapping.Color, kinds: ~typing.Literal[<enum 'kind'>], grad_npts: int = 12, grad_funcs: ~fractalshades.numpy_utils.expr_parser.Numpy_expr = 'x', extent: ~typing.Literal[<enum 'extent'>] = 'mirror')[source]
__init__(colors: ~fractalshades.colors.color_mapping.Color, kinds: ~typing.Literal[<enum 'kind'>], grad_npts: int = 12, grad_funcs: ~fractalshades.numpy_utils.expr_parser.Numpy_expr = 'x', extent: ~typing.Literal[<enum 'extent'>] = 'mirror')[source]

Fractal_colormap, concatenates (n-1) color gradients (passing through n colors).

Parameters:
colorsrgb float np.array of shape [n, 3]

The successives colors of the colormap

kinds: arrays of string [n-1] , “Lab” or “Lch”

The kind of gradient between colors n and n+1 : either linear in Lab space of Lch space

grad_nptsint np.array of size [n-1]

number of internal points stores, gradient between colors n and n+1 a typical value is 32.

grad_funcs[n-1] array of callables mapping [0, 1.] to [0., 1]

These are passed to each gradient. Callable passed as a string expression of the “x” variable (ie, the callable is the evaluation of “lambda x: “ + expr). Default to identity (“x”).

extent“clip” | “mirror” | “repeat”

What to do with out-of-range values.

Notes

Note

See also the colormap section of the gallery for the available templates.