cosmicfish_pylib.colorsΒΆ
A collection of color utilities.
| nice_colors | This function returns a color from a colormap defined below according to the number entered. | 
| bash_colors | This class contains the necessary definitions to print to bash screen with colors. | 
- 
class cosmicfish_pylib.colors.bash_colors[source]
- This class contains the necessary definitions to print to bash screen with colors. Sometimes it can be useful and nice! - Variables: - HEADER – ANSI color for light purple.
- OKBLUE – ANSI color for blue.
- OKGREEN – ANSI color for green.
- WARNING – ANSI color for yellow.
- FAIL – ANSI color for red.
- BOLD – ANSI code for bold text.
- UNDERLINE – ANSI code for underlined text.
- ENDC – ANSI code to restore the bash default.
 - 
BOLD= '\x1b[1m'
- ANSI code for bold text. 
 - 
ENDC= '\x1b[0m'
- ANSI code to restore the bash default. 
 - 
FAIL= '\x1b[91m'
- ANSI color for red. 
 - 
HEADER= '\x1b[95m'
- ANSI color for light purple. 
 - 
OKBLUE= '\x1b[94m'
- ANSI color for blue. 
 - 
OKGREEN= '\x1b[92m'
- ANSI color for green. 
 - 
UNDERLINE= '\x1b[4m'
- ANSI code for underlined text. 
 - 
WARNING= '\x1b[93m'
- ANSI color for yellow. 
 - 
blue(string)[source]
- Function that returns a string that can be printed to bash in - cosmicfish_pylib.colors.bash_colors.OKBLUEcolor.- Parameters: - string (string) – input string. - Returns: - the input string with the relevant ANSI code at the beginning and at the end. - Return type: - string 
 - 
bold(string)[source]
- Function that returns a string that can be printed to bash in - cosmicfish_pylib.colors.bash_colors.BOLDcolor.- Parameters: - string (string) – input string. - Returns: - the input string with the relevant ANSI code at the beginning and at the end. - Return type: - string 
 - 
fail(string)[source]
- Function that returns a string that can be printed to bash in - cosmicfish_pylib.colors.bash_colors.FAILcolor.- Parameters: - string (string) – input string. - Returns: - the input string with the relevant ANSI code at the beginning and at the end. - Return type: - string 
 - 
green(string)[source]
- Function that returns a string that can be printed to bash in - cosmicfish_pylib.colors.bash_colors.OKGREENcolor.- Parameters: - string (string) – input string. - Returns: - the input string with the relevant ANSI code at the beginning and at the end. - Return type: - string 
 - 
header(string)[source]
- Function that returns a string that can be printed to bash in - cosmicfish_pylib.colors.bash_colors.HEADERcolor.- Parameters: - string (string) – input string. - Returns: - the input string with the relevant ANSI code at the beginning and at the end. - Return type: - string 
 
- 
cosmicfish_pylib.colors.nice_colors(num)[source]
- This function returns a color from a colormap defined below according to the number entered. - Parameters: - num ( - intor- float) – input number. Can be an integer or float. Notice that the colormap contains only a small numbers of colors. Even if the input is a float the output will still be one of the few colors in the colormap.- Returns: - tuple of - floatcontaining the three RGB coordinates of the color.- Return type: - tuple