As we all know python's default output text color in terminal is white, but to make it look much better and make more interactive we have to change it's output text color.
Can we change text color?
Yes we can change output text color. To do this we have to use a module named colorama.
Steps to change text color:
Installing modules:
To install modules open your powershell window and type the following command and press enter.
pip install colorama
Importing module:
import colorama from colorama import Fore,Back
initialzing module:
colorama.init(autoreset=True)
Changing color:
At place of blue you can write any primary or secondory color but it should be block letters
Changing Foreground color:
print (Fore.BLUE+'Your Text')
Changing Background color:
print (Back.BLUE+'Your Text')
Full code:
import colorama from colorama import Fore,Back #initialzing colorama colorama.init(autoreset=True) #changing foreground color print (Fore.BLUE+'Your Text') #changing background color print (Back.BLUE+'Your Text')
For better understanding you can also Watch this video.
Please do share it with you friend and comment down if you have any query or suggestions.
0 Comments