Click here to Skip to main content
13,833,837 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am trying to print a colored message using the below code. I am able to print the message but not in color. Kindly help me finding out the issue.

What I have tried:

from pyfiglet import figlet_format
from termcolor import colored

msg =input("Enter the message you want to dispaly ")
colour = input("Enter the colour you wish ")

art = figlet_format(msg)
colored_art= colored(art, color=colour)
Bryian Tan 12-Aug-18 21:57pm
What terminal the code is running on?
Member 13946645 12-Aug-18 22:19pm
Windows PowerShell
Bryian Tan 12-Aug-18 23:41pm
just curious, did it print out the color character? something like [31mhello when execute print (colored('hello', 'red'))
Member 13946645 13-Aug-18 9:51am
Yes, it did print the text in exact way([31mhello) but it was not colored.
Bryian Tan 13-Aug-18 10:46am
try the colorama package
Member 13946645 21-Aug-18 15:22pm
It worked :-) Thanks a ton sir
Richard MacCutchan 13-Aug-18 3:32am
Normal print statements will likely not work since they do not understand formatting, and will not send the correct control sequences to the screen. You need to check the documentation for these packages.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.190114.1 | Last Updated 12 Aug 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100