Reputation: 4084
I recently found the very fun perl module Term::ANSIColor for changing my text color. Basically, all i need to do to change perl stdout text color is something like...
print color("red")."My sample text\n";
However, after exiting the script, my terminal is now only printing in red as well! Is there some function for return the console to the original color that I can include at the end of my script?
Upvotes: 1
Views: 701
Reputation: 4581
Use colored()
instead of color()
. This will reset the coloring after the string is printed:
print colored("My sample text\n", "red");
Upvotes: 8
Reputation: 1979
Term::ANSIColor doc page says that to get back to normal text you should use reset
keyword.
print color 'bold blue';
print "This text is bold blue.\n";
print color 'reset';
print "This text is normal.\n";
Also I recommend to look at Constant Interface
Upvotes: 4