def cmap_from_color(color, dark=False):
    '''
    Generates a matplotlib colormap from a single color.

    Colormap will be built, by default, from white to ``color``.

    Args:

        color: Can be one of several things:

            1. Hex code
            2. HTML color name
            3. RGB tuple

        dark (bool): If ``True``, colormap will be built from ``color`` to
            black. Default is ``False``, which builds a colormap from
            white to ``color``.

    Returns:

        colormap: A matplotlib colormap

    '''
    if dark:
        return sns.dark_palette(color, as_cmap=True)
    else:
        return sns.light_palette(color, as_cmap=True)
Generates a matplotlib colormap from a single color.

    Colormap will be built, by default, from white to ``color``.

    Args:

        color: Can be one of several things:

            1. Hex code
            2. HTML color name
            3. RGB tuple

        dark (bool): If ``True``, colormap will be built from ``color`` to
            black. Default is ``False``, which builds a colormap from
            white to ``color``.

    Returns:

        colormap: A matplotlib colormap