Skip to content
New: Star-import, signal unraveling, Python 3.12 support, and more

# 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.

#### Cookie consent

We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.

- Google Analytics
- GitHub

Manage settings