Extract Hex Colors

Description

Convers the current object into an object of class hexcols and extracts the hex colors as list of str.

If the object contains alpha values, the alpha level is added to the hex string if and only if alpha is not equal to 1.0.

Usage

hexcols.colors(fixup=True, rev=False)

Arguments

fixupbool
Whether or not to correct rgb values outside the defined range of [0., 1.], defaults to True.
revbool
Should the color palette be reversed? Defaults to False.

Return

list: Returns a list of hex color strings.

Examples

from colorspace import HCL, sRGB, HSV
# Example using HCL colors
cols = HCL([0, 40, 80],
           [30, 60, 80],
           [85, 60, 35])
cols.colors()
['#FAC8D1', '#C08353', '#5F5500']
# Example using sRGB colors
cols = sRGB([0.01, 0.89, 0.56],
            [0.25, 0.89, 0.02],
            [0.65, 0.89, 0.23])
cols.colors()
['#0340A6', '#E3E3E3', '#8F053B']
# Example using HSV colors
cols = HSV([218, 0, 336],
           [1, 0, 1],
           [0.65, 0.89, 0.56])
cols.colors()
['#003DA6', '#E3E3E3', '#8F0039']