from print_color import print
print("Hello world", tag='success', tag_color='green', color='white')
Print Color is a minimalist approach to terminal color printing in Python. It is a wrapper around the print()
function, and simply allows you to provide extra optional parameters such as:
tag
tag_color
ortag_colour
tag_format
color
orcolour
background
format
It aims to be a customizable logger for your applications, and makes formatting warnings, info messages and errors a breeze.
This project has no dependencies, apart from pytest
for testing.
Check out this project on PyPi here.
Colors:
purple
blue
green
yellow
red
magenta
cyan
white
black
tag
- any string
tag_color
ortag_colour
- color
color
orcolour
- color
background
- color
format
- bold
- underline
- blink
pip3 install print-color
- python 3.7^
from print_color import print
print("Hello world", tag='success', tag_color='green', color='white')
print("Error detected", tag='failure', tag_color='red', color='magenta')
print("Printing in color", color='green', format='underline', background='grey')
Feel free to add or improve this project :) Just create a pull request and explain the changes you propose. Note that as this is a very simple project, feature requests should be kept minimal - things like more colors, formats etc would be ideal.
Built with Python Poetry.