In this blog we will learn to add colors in foreground and background of text Python IDLE .
First we have to install colored library using pip command.
pip install colored
After installing library we have to import colored library then using colored.fg(‘color_name’) function foreground color of text can be changed. To change background of the text colored.bg(‘color_name’) function is used.
import colored
print(colored.fg(‘red’)+colored.bg(‘blue’)+’Hello World !’)
In the below video Pydroid 3 is used which runs the Python source code on android.
Colors available in python are below.

Leave a comment