def with_color(string, fg, bg=49):
print "[0m[%d;%dm%s[0m" % (fg, bg, string)
return 0
def B(string):
print "[1m%s[22m" % string
return 0
#front color
Red = 1
Green = 2
Yellow = 3
Blue = 4
Magenta = 5
Cyan = 6
White = 7
def fr(string):
return with_color(string, Red+30) # Red
def fg(string):
return with_color(string, Green+30) # Green
def fy(string):
return with_color(string, Yellow+30) # Yellow
def fb(string):
return with_color(string, Blue+30) # Blue
def fm(string):
return with_color(string, Magenta+30) # Magenta
def fc(string):
return with_color(string, Cyan+30) # Cyan
def fw(string):
return with_color(string, White+30) # White
fr("red")
fy("yellow")
fm("magenta")
fg("green")
fc("cyan")
转载于:https://blog.51cto.com/quietguoguo/2301081
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/101364.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...