Changing Text Color

I am trying to change the color of the text in my print statement to green or any other color.
Screenshot 2023-02-22 9.26.18 AM
Can someone help me with this, please?

1 Like
from colorama import Fore, init

init(autoreset=True)
print(f"{Fore.RED}Hey").
3 Likes

Try not to use colorama :wink: instead try straight ansi color codes (some random blog I found from a search)

2 Likes

True but I was able to do that faster then finding ansi color codes.

2 Likes

I recommend bookmarking python terminal colors · GitHub

BLACK   = '\033[30m'
RED     = '\033[31m'
GREEN   = '\033[32m'
YELLOW  = '\033[33m'
BLUE    = '\033[34m'
MAGENTA = '\033[35m'
CYAN    = '\033[36m'
WHITE   = '\033[37m'
RESET   = '\033[39m'

print(f'{GREEN}Your number is ({c}){RESET}')
3 Likes

Thanks for the help! :+1: :+1:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.