Two classes for querying colors
- class plot_utils.Color(color, is_rgb_normalized=True)[source]
A class that defines a color.
- Parameters:
color (str or <tuple> or <list>) – The color information to initialize the Color object. Can be a list or tuple of 3 elements (i.e., the RGB information), or a HEX string such as “#00FF00”, or XKCD color names (https://xkcd.com/color/rgb/) or X11 color names (http://cng.seas.rochester.edu/CNG/docs/x11color.html).
is_rgb_normalized (bool) – Whether or not the input information (if RGB) contains the normalized values (such as [0, 0.5, 0.5]). This parameter has no effect if the input is not RGB.
- as_hex()[source]
Exports the color object as HEX values.
- Returns:
hex_val – HEX value.
- Return type:
str
- as_rgb(normalize=True)[source]
Export thes color as RGB values.
Parameter
- normalizebool
Whether or not to return the normalized (between 0 and 1) RGB.
- returns:
rgb_val – RGB values in three numbers.
- rtype:
tuple<float>
- class plot_utils.Multiple_Colors(colors, is_rgb_normalized=True)[source]
A class that defines multiple colors.
- Parameters:
colors (list) –
A list of color information to initialize the Multiple_Colors object. The list elements can be:
a list or tuple of 3 elements (i.e., the RGB information)
a HEX string such as “#00FF00”
an XKCD color name (https://xkcd.com/color/rgb/)
an X11 color name (http://cng.seas.rochester.edu/CNG/docs/x11color.html)
Different elements of colors do not need to be of the same type.
is_rgb_normalized (bool) – Whether or not the input information (if RGB) contains the normalized values (such as [0, 0.5, 0.5]). This parameter has no effect if the input is not RGB.
- as_hex()[source]
Exports the colors as a list of HEX values
- Returns:
hex_list – A list of HEX colors
- Return type:
list<str>
- as_rgb(normalize=True)[source]
Exports the colors as a list of RGB values
Parameter
- normalizebool
Whether or not to return the normalized (between 0 and 1) RGB.
- returns:
rgb_list – A list of list: each sub-list represents a RGB color in three numbers.
- rtype:
list<list<float>>