Hi colorama, Hi color!

Sonia Ben Saâd
2 min readFeb 28, 2023

--

If you appreciate colors you must love Colorama in programming .

Colorama is a Python module that allows you to easily add colored text to your terminal output. It works on both Windows and Unix-based systems.

To use Colorama, you need to install it first. You can install it using pip, which is a package installer for Python. Open your terminal or command prompt and enter the following command:

pip install colorama
import colorama
from colorama import Fore, Back, Style

Once installed you must import it, you can import the init function from the colorama module to initialize the colorama module. This is required before you can start using colorama. Here's an example:

from colorama import init # Initialize colorama init()

Now you can start using colorama to add colored text to your output. Here’s an example that prints a message :

from colorama import Fore, Style, Back
colorama.init(autoreset=True)
print(Fore.YELLOW + Back.LIGHTRED_EX + Style.BRIGHT + "Hi You" + Fore.GREEN + Back.RED + Style.BRIGHT + "i'am here, 'am Colorama")
print(Fore.CYAN + Back.YELLOW + Style.BRIGHT + "Color is life")
print(Back.CYAN + Style.DIM + "How are You Today")
These are examples of how to use Colorama in Python to add color and style to terminal output.

The first line uses yellow foreground color, light red background color, and bright style for the text “Hi You”, and then switches to green foreground color, red background color, and bright style for the text “‘i’am Colorama”.

The second line uses cyan foreground color, yellow background color, and bright style for the text “Color is life”.

The third line uses cyan background color, dim style, and prints the text “How are You Today”. The output will look like this:

output of the Code

I Hope you enjoy it .

--

--