你自己的表现力画家谁的颜色文字在你的终端。
painter的Python项目详细描述
painter是基于 chalk和 colors.js node.js的库。然而,painter试图提供 读起来像英语的表达性api。
油漆工经过全面测试,覆盖率100%,并且完全剥落8 也很顺从!
快速启动
在您的virtualenv中安装painter,如下所示:
pip install painter
现在,使用它向终端输出颜色:
from__future__importprint_functionfrompainterimportpaint# Simple printing of colorsprint('Welcome to Painter!',paint.red('I can paint things red'),paint.blue('and blue'))# Chaining colors and stylesprint(paint.blue.on_red.bold.underline('and far more complex combos too'))print()# Using color patternsprint(paint.rainbow('Awww look, a pretty rainbow :)'))print(paint.zebra('and a scary looking zebra!'))print()# Nested paintingprint(paint.on_red('I can also use a background color across',paint.blue('multiple'),paint.yellow('foreground colors')))# Custom separatorprint(paint('and','allow','you to use',paint.red('custom separators'),sep='-'))print()# Creating themescool_theme=paint.green.on_red.underline.boldprint('Creating',cool_theme('your own theme'),'is easy')# Easily disable painting of colorspaint.enabled=Falseprint('and I allow you to easily',paint.red('disable'),paint.blue('me'))print()paint.enabled=Trueprint('Hope you have a',paint.blue('lovely day!'),paint.green(':)'))
此脚本的输出如下:
文档
有关使用painter的详细信息,请查看 Painter GitHub Page。