print with color on the console.
pip install console-color
- 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
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
★Click me to see the HTML which is converted from ipynb
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)
The below link may help you to understand how do you write, such as this library by yourself.
See the documentation