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.

colorNone/tuple/string | None

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

defaulttuple | (1,1,1)

The default color to use instead.

lengthint | 1

The length of the output array.

alphafloat | 1

The opacity (Last digit of the RGBA tuple).

faces_indexbool | False

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