Skip to content

colors module

Utilities for working with colors.


adjust_lightness function

adjust_lightness(
    color,
    amount=0.7
)

Lightens the given color by multiplying (1-luminosity) by the given amount.

Input can be matplotlib color string, hex string, or RGB tuple. Output will be an RGB string.


adjust_opacity function

adjust_opacity(
    color,
    opacity
)

Adjust opacity of color.


map_value_to_cmap function

map_value_to_cmap(
    value,
    cmap,
    vmin=None,
    vcenter=None,
    vmax=None
)

Get RGB of value from the colormap.


parse_rgb_tuple function

parse_rgb_tuple(
    color
)

Parse floating RGB tuple from string.


parse_rgba_tuple function

parse_rgba_tuple(
    color
)

Parse floating RGBA tuple from string.