+ 1
How to take font color??
please answer
3 Answers
+ 3
Nnnn Nnnn ,
printing colored text in the console can be also done with the module "termcolor". before using it, we must install it by using pip.
import termcolor
print (termcolor.colored('hello', 'red'), termcolor.colored('world', 'green'))
+ 2
Can you elaborate your question? It is not clear what you want to know.
+ 1
If you want to know how text formatting works in the console, then add the following to text that you will output to console:
Start:
"\x1b[" - for hexadecimal
"\u001b[" - for unicode
"\033[" - for decimal
Style:
Normal - 0
Bold - 1
Light - 2
Italicized - 3
Underlined - 4
Blink - 5
Text color:
Black - 30
Red - 31
Green - 32
Yellow - 33
Blue - 34
Purple - 35
Cyan - 36
White - 37
Background color:
Black - 40
Red - 41
Green - 42
Yellow - 43
Blue - 44
Purple - 45
Cyan - 46
White - 47
Separate numbers with ";"
Then close your formatting with "m"
Example:
print("\x1b[1;3;36;44mHi!")