Console Color

print with color on the console.

Install

pip install console-color

Features

  • It allows you to register your own styles.

  • Supports fore, background, style (Bold, Italic, URL, …), and you can do permutations, really flexible.

  • Well documented, you can find all the usage form test.py folder and console_color.ipynb

Note

Github page may not show ipynb well, you can go here to see another resource that I put on Google Colab

Usage

from console_color import *

# cprint(text, fg=, bg=, style=)
cprint('...', RGB.WHITE, '#ff0000', Style.BOLD + Style.URL)
cprint('...', (255, 0, 0), RGB.YELLOW, Style.BOLD + Style.URL)

# you can do permutations, for example, you only need style only then
cprint('...', style=Style.BOLD)

# combine with normal text
print('123' + cprint('...', '#ff0000', pf=False) + '~~~')

Note

get more help; please reference the test.py and console_color.ipynb

Demo

★Click me to see the HTML which is converted from ipynb

https://raw.githubusercontent.com/CarsonSlovoka/console-color/release/doc/_static/nav_bar.logo.png

Contributing

If you want to contribute, please use the release branch as the stable branch. dev is the future branch for the maintainer.

Be sure to write tests for new features. If you have any difficulties, you can ask me or discuss with me. I am glad if you want to join us.

By the way, I’m very friendly! (You can ask me questions with Chinese)

Useful Reference

The below link may help you to understand how do you write, such as this library by yourself.

More

See the documentation