how do you color your text/print
made a print but i want it to be a different color
TEXT STYLE: CODE
No effect: 0
TEXT COLOR: CODE
BACKGROUND COLOR: CODE
The first thing you do when styling text in python is you start with an escape code. The escape code for this will always be the same.
This is the escape code:
Next, you put the code for text style:
(if you don't care what style you want just use 0)
You will always use a semi-colon to separate your style codes.
Next, you put the code for text color:
Next, you put the code for what background color you want:
The above example would show green text, bold, with a background color of yellow.
You add text by just typing directly after the m in the background color code:
print("\033[1;33;44m Charles Robison")
You put the style code directly in the string.
Caleb had a very good answer but a simple answer would be to import the
colored module where
colored.fore contains the different colors so you can do
From colored import fore print(fore.RED + ‘This is red!’) print(‘This is still red!’ + fore.WHITE) print(“Now White!”)