mcfonts.utils.colors
¶
ANSI color escapes.
The global variable USE_COLORS
controls whether these will be used in outputs.
Set
USE_COLORS
= False to disable colored output.Set
USE_COLORS
= True to enable colored output.
Module Contents¶
Functions¶
|
Given number, return a colorized and pretty-print version of that number. |
Attributes¶
Whether to include ANSI color escapes in some prints. |
|
- mcfonts.utils.colors.BLACK_BACK¶
- mcfonts.utils.colors.BLACK_FORE¶
- mcfonts.utils.colors.BLUE_BACK¶
- mcfonts.utils.colors.BLUE_FORE¶
- mcfonts.utils.colors.BRIGHT¶
- mcfonts.utils.colors.CYAN_BACK¶
- mcfonts.utils.colors.CYAN_FORE¶
- mcfonts.utils.colors.DIM¶
- mcfonts.utils.colors.GREEN_BACK¶
- mcfonts.utils.colors.GREEN_FORE¶
- mcfonts.utils.colors.MAGENTA_BACK¶
- mcfonts.utils.colors.MAGENTA_FORE¶
- mcfonts.utils.colors.RED_BACK¶
- mcfonts.utils.colors.RED_FORE¶
- mcfonts.utils.colors.RESET_ALL¶
- mcfonts.utils.colors.RESET_BACK¶
- mcfonts.utils.colors.RESET_FORE¶
-
mcfonts.utils.colors.USE_COLORS =
True
¶ Whether to include ANSI color escapes in some prints. Set this to False if your console/terminal does not support ANSI color escapes.
- mcfonts.utils.colors.WHITE_BACK¶
- mcfonts.utils.colors.WHITE_FORE¶
- mcfonts.utils.colors.YELLOW_BACK¶
- mcfonts.utils.colors.YELLOW_FORE¶
- mcfonts.utils.colors.color_number(number)¶
Given number, return a colorized and pretty-print version of that number.
Note
If
mcfonts.colors.USE_COLORS
is False, color won't be applied.If number is negative, it will be in red. If number is positive, it will be in green. If number is zero, it will have no colors.
>>> color_number(4) '\x1b[32m+4\x1b[39m' >>> color_number(-4) '\x1b[31m-4\x1b[39m' >>> color_number(-39924) '\x1b[31m-39,924\x1b[39m'
Last update:
2023 November 30