sns_toolbox.color_utilities

Utility functions for dealing with network colors.

Module Contents

Functions

valid_color(→ bool)

Check if a given color is within the standard svg set.

set_text_color(→ str)

Set the text color to white or black given a valid color string.

Attributes

SETOFVALIDCOLORS

Set of standard SVG color names.

COLORSWHITETEXT

Set of background colors which work better with white text for improved visibility.

sns_toolbox.color_utilities.SETOFVALIDCOLORS

Set of standard SVG color names.

sns_toolbox.color_utilities.COLORSWHITETEXT

Set of background colors which work better with white text for improved visibility.

sns_toolbox.color_utilities.valid_color(color: str = None) bool

Check if a given color is within the standard svg set.

Parameters:

color (str, optional) – Desired color, default is None.

Returns:

True if it is a valid color, false if not.

Return type:

bool

sns_toolbox.color_utilities.set_text_color(color: str = None) str

Set the text color to white or black given a valid color string.

Parameters:

color (str, optional) – Background color, default is None.

Returns:

Text color based on background color.

Return type:

str