colort

Display colored text in the terminal


Keywords
color, terminal
License
MIT
Install
pip install colort==0.4

Documentation

colort

终端中的彩色显示

使用

安装

pip install colort

使用

from colort import display_style as ds

src = "这是要显示的文本"
dist = ds.format_with_one_style(src, ds.foreground_color.red)
print("更改文字颜色:", dist)
dist = ds.format_with_one_style(src, ds.backgorud_color.green)
print("更改文字背景色:", dist)
dist = ds.format_with_multiple_styles(src, ds.foreground_color.red, ds.mode.underline, ds.mode.bold)
print("多种样式:", dist)

效果:

sample