Get Colors

Description

Returns the colors of the current color palette.

Usage

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

Arguments

nint
Number of colors which should be returned, defaults to 11.
fixupNone, bool
should sRGB colors be corrected if they lie outside the defined color space? If None the fixup parameter from the object will be used. Can be set to True or False to explicitly control the fixup here.
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 qualitative_hcl, rainbow_hcl
qualitative_hcl("Dark 3").colors()
['#E16A86',
 '#D17B44',
 '#B28D00',
 '#829C00',
 '#20A73C',
 '#00AD7F',
 '#00ABB2',
 '#00A0D6',
 '#7B8AE6',
 '#C071DC',
 '#DE63B9']
# Five colors with constant alpha of 0.3
qualitative_hcl().colors(5, alpha = 0.3)
['#E16A864D', '#AA90004D', '#00AA5A4D', '#00A6CA4D', '#B675E04D']
# Three colors with variying alpha
qualitative_hcl().colors(3, alpha = [0.2, 0.8, 0.3])
['#E16A8633', '#50A315CC', '#009ADE4D']
# Same for rainbow_hcl which is a special
# version of the qualitative HCL color palette
rainbow_hcl().colors(4)
['#E495A5', '#ABB065', '#39BEB1', '#ACA4E2']