1 Star 1 Fork 0

lavenliu / MyPy3

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
color.py 652 Bytes
AI 代码解读
一键复制 编辑 原始数据 按行查看 历史
lavenliu 提交于 2020-09-09 17:53 . first add
import os
def _wrap_with(code):
def inner(text, bold=False):
c = code
if os.environ.get('FABRIC_DISABLE_COLORS'):
return text
if bold:
c = "1;{0}".format(c)
return "\033[{0}m{1}\033[0m".format(c, text)
return inner
red = _wrap_with('31')
green = _wrap_with('32')
yellow = _wrap_with('33')
blue = _wrap_with('34')
magenta = _wrap_with('35')
cyan = _wrap_with('36')
white = _wrap_with('37')
print(red('hello world'))
print(green('hello world'))
print(yellow('hello world'))
print(blue('hello world'))
print(magenta('hello world'))
print(cyan('hello world'))
print(white('hello world'))
Python
1
https://gitee.com/lavenliu/my-py3.git
git@gitee.com:lavenliu/my-py3.git
lavenliu
my-py3
MyPy3
main

搜索帮助