Reputation: 1
I need a python module that prints a colored output text for input() and print() functions which works on idle, Powershell, and Linux consols.
I am just expecting few colors (no extra background features required) and the same functions should work equally on python idle, PowerShell, terminal, and cmd with full flexibility of code.
Upvotes: 0
Views: 506
Reputation: 37
clrprint does a good job of printing in color - 'b' for blue, 'g' for green, 'r' for red, 'd' for default (black), 'p' for purple & 'y' for yellow
To print a single value in color, use clr=color (specify the color in quotes) To print multiple values in color, use clr=[list of color strings] (specify the colors in quotes, within a list.
# pip install clrprint as mentioned above
from clrprint import *
clrprint("Big data", clr='b') # Print 1 value on a line
clrprint("Big", "data", clr=['y','d']) # Print multiple values on the same line
x = 5
clrprint("x =", x, clr=['g', 'p']) # Print variable value
name = clrinput('Enter name: ', clr=['p', 'd']) # input a value
Upvotes: 0
Reputation: 103
You can use 'clrprint' module which works for idle, terminal and PowerShell too
pip install clrprint
from clrprint import *
clrhelp() # print's available colors and usage
user_input = clrinput("input please: ",clr='r') # just like input() [color is red]
clrprint('your text',user_input,clr='green') # just like print()
Take a look at https://github.com/AbhijithAJ/clrprint for more info and screenshots.
Upvotes: 1