visbrain.utils.color2vb

visbrain.utils.color2vb(color=None, default=(1.0, 1.0, 1.0), length=1, alpha=1.0, faces_index=False)[source][source]

Turn into a RGBA compatible color format.

This function can tranform a tuple of RGB, a matplotlib color or an hexadecimal color into an array of RGBA colors.

Parameters:
color : None/tuple/string | None

The color to use. Can either be None, or a tuple (R, G, B), a matplotlib color or an hexadecimal color ‘#…’.

default : tuple | (1,1,1)

The default color to use instead.

length : int | 1

The length of the output array.

alpha : float | 1

The opacity (Last digit of the RGBA tuple).

faces_index : bool | False

Specify if the returned color have to be compatible with faces index (e.g a (n_color, 3, 4) array).