Get Colors

Description

Returns the colors of the current color palette.

Usage

rainbow.colors(n=11, alpha=None, **kwargs)

Arguments

nint
Number of colors which should be returned. Defaults to 11.
alphaNone, float, list, or numpy.ndarray
Allows to add an transparency (alpha channel) to the colors. Can be a single float, a list, or a numpy array. If a list or array is provided it must be of length 1 or of length n and be convertible to float, providing values between 0.0 (full opacity) and 1.0 (full transparency)
**kwargs
Currently allows for rev = True to reverse the colors.

Return

list: Returns a list of str with n colors from the color palette.

Examples

from colorspace import rainbow
rainbow().colors(4)
['#FF0000', '#80FF00', '#00FFFF', '#8000FF']

Raises

  • ValueError: If input n is not float/int or smaller than 1.