COLORS
#
Module colors
is for print complex color in the console output with your
own texts. Also, this module is for showing example colors that’s you might be
used in your project.
FUNCTION set_complex_color
#
- mdsanima_dev.colors.set_complex_color() str #
Define color console variables.
Warning
Do not use this function in your code, it is needed to perform other functions.
- Returns:
Color console literal variable.
- Return type:
str
- Usage:
Assigning a function to a variable:
sx, xm, ex = complex_color() start_c, middle_c, end_c = complex_color()
FUNCTION get_color
#
- mdsanima_dev.colors.get_color(text: str = 'mdsanima', color: int = 255) str #
This function is almost the same as get_complex_color function.
The difference is that the return is a sequence of unicode characters and to get the output in the terminal in a color you need to use the print function.
- Parameters:
text (str, optional) – The text you want to use for color output in the console, defaults to
mdsanima
.color (int, optional) – The color number you want to use for color output in the console, defaults to
255
.
- Returns:
Colored text output in the console.
- Return type:
str
- Usage:
Assigning a function by calling to variable or assigning a function to a variable just add after import
mds = get_color
and in the next line typemds_a = mds("I love Python", 86)
in your code:from mdsanima_dev.colors import get_color mds_a = get_color("I love Python", 86) mds_b = get_color("mdsanima", 186) print(mds_a, mds_b)
Also you can use machine function:
from mdsanima_dev.colors import get_color from mdsanima_dev.utils.tools import machine mds = get_color mds_a = mds("I love Python", 86) mds_b = mds("mdsanima", 186) machine(mds_a + " " + mds_b, 0.01)
FUNCTION get_complex_color
#
- mdsanima_dev.colors.get_complex_color(text: str = 'mdsanima', color: int = 255, end=None) str #
This feature allows you to print colored text to the output of the console. Now the function works the same like print function.
- Parameters:
text (str, optional) – The text you want to use for color output in the console, defaults to
mdsanima
.color (int, optional) – The color number you want to use for color output in the console, defaults to
255
.end (str, optional) – End of line print, defaults to
None
.
- Returns:
Colored text output in the console.
- Return type:
str
- Usage:
Assigning a function to a variable
mds
then function calling returning printing colored text on the same line:from mdsanima_dev.colors import get_complex_color mds = get_complex_color mds(color=44) mds("mdsa", 160, " ") mds("mds", 88, " ") mds(text="mds", color=99, end=" ") mds("mds", 86) mds(end="mdsanima-dev", color=85, text="mds")
FUNCTION show_complex_color
#
- mdsanima_dev.colors.show_complex_color(number: bool = False) str #
Function prints all available colors with a number or only text.
- Parameters:
number (bool, optional) – Show color number, defaults to
False
.- Returns:
Show all colors in the console output.
- Return type:
str
- Usage:
Function calling:
from mdsanima_dev.colors import show_complex_color show_complex_color(False) show_complex_color(True)
EXAMPLE show_complex_color(False)
#
This is a example screenshots of the Shell Terminal in different variants, just for fun.
EXAMPLE show_complex_color(True)
#
This is a example screenshots of the Shell Terminal in different variants, just for fun.
Note
Now you know what numbers you have withs different colors, now you can use the function get_complex_color in your code.