color_utilities
Module containing beautiful color schemes and some color utilities to color print in bash.
- Authors:
Giulia Longhi, gllonghi2@gmail.com (color schemes) Marco Raveri, marco.raveri@unige.it (code)
- tensiometer.utilities.color_utilities.BASH_BLUE = '\x1b[94m'
ANSI color for blue.
- tensiometer.utilities.color_utilities.BASH_BOLD = '\x1b[1m'
ANSI code for bold text.
- tensiometer.utilities.color_utilities.BASH_ENDC = '\x1b[0m'
ANSI code to restore the bash default.
- tensiometer.utilities.color_utilities.BASH_GREEN = '\x1b[92m'
ANSI color for green.
- tensiometer.utilities.color_utilities.BASH_PURPLE = '\x1b[95m'
ANSI color for light purple.
- tensiometer.utilities.color_utilities.BASH_RED = '\x1b[91m'
ANSI color for red.
- tensiometer.utilities.color_utilities.BASH_UNDERLINE = '\x1b[4m'
ANSI code for underlined text.
- tensiometer.utilities.color_utilities.BASH_YELLOW = '\x1b[93m'
ANSI color for yellow.
- tensiometer.utilities.color_utilities.bash_blue(string)[source]
Return a string that can be printed to bash in
tensiometer.utilities.color_utilities.BASH_BLUE.- Parameters:
string – input string.
- Returns:
the input string with the relevant ANSI code at the beginning and at the end.
- tensiometer.utilities.color_utilities.bash_bold(string)[source]
Return a string that can be printed to bash in
tensiometer.utilities.color_utilities.BASH_BOLD.- Parameters:
string – input string.
- Returns:
the input string with the relevant ANSI code at the beginning and at the end.
- tensiometer.utilities.color_utilities.bash_green(string)[source]
Return a string that can be printed to bash in
tensiometer.utilities.color_utilities.BASH_GREEN.- Parameters:
string – input string.
- Returns:
the input string with the relevant ANSI code at the beginning and at the end.
- tensiometer.utilities.color_utilities.bash_purple(string)[source]
Return a string that can be printed to bash in
tensiometer.utilities.color_utilities.BASH_PURPLE.- Parameters:
string – input string.
- Returns:
the input string with the relevant ANSI code at the beginning and at the end.
- tensiometer.utilities.color_utilities.bash_red(string)[source]
Return a string that can be printed to bash in
tensiometer.utilities.color_utilities.BASH_RED.- Parameters:
string – input string.
- Returns:
the input string with the relevant ANSI code at the beginning and at the end.
- tensiometer.utilities.color_utilities.bash_underline(string)[source]
Return a string that can be printed to bash in
tensiometer.utilities.color_utilities.BASH_UNDERLINE.- Parameters:
string – input string.
- Returns:
the input string with the relevant ANSI code at the beginning and at the end.
- tensiometer.utilities.color_utilities.bash_yellow(string)[source]
Return a string that can be printed to bash in
tensiometer.utilities.color_utilities.BASH_YELLOW.- Parameters:
string – input string.
- Returns:
the input string with the relevant ANSI code at the beginning and at the end.
- tensiometer.utilities.color_utilities.color_linear_interpolation(rgb_1, rgb_2, alpha)[source]
This function performs a linear color interpolation in RGB space. alpha has to go from zero to one and is the coordinate.
- tensiometer.utilities.color_utilities.nice_colors(num, colormap='the_gold_standard', interpolation_method='linear', output_format='RGB_255')[source]
Return a color from a named colormap.
- Parameters:
num – input number. If integer, returns one of the colors in the colormap. If float, returns a shade combining two neighboring colors.
colormap – name of the colormap.
interpolation_method –
method used to interpolate between colors. Supported values:
linear: linear interpolation.
output_format –
output format of the color. Supported values:
HEXRGBRGB_255(default)
- Returns:
string with HEX color or tuple with RGB coordinates.
- Raises:
ValueError – if the colormap, interpolation_method, or output_format is invalid.