term color define only by number
[rainbowstream.git] / rainbowstream / colors.py
CommitLineData
6fa09c14
VNM
1
2def basic_color(code):
3 """
4 16 colors supported
5 """
6 def inner(text, bold=True):
533edcdb
VNM
7 c = code
8 if bold:
9 c = "1;%s" % c
10 return "\033[%sm%s\033[0m" % (c, text)
11 return inner
8c840a83 12
6fa09c14 13
37ae740e 14def term_color(code):
6fa09c14
VNM
15 """
16 256 colors supported
17 """
93384849 18 def inner(text):
6fa09c14 19 c = code
6fa09c14
VNM
20 return "\033[38;5;%sm%s\033[0m" % (c, text)
21 return inner
22
23
c075e6dc
O
24default = basic_color('39')
25black = basic_color('30')
26red = basic_color('31')
27green = basic_color('32')
28yellow = basic_color('33')
29blue = basic_color('34')
30magenta = basic_color('35')
31cyan = basic_color('36')
32grey = basic_color('90')
33light_red = basic_color('91')
34light_green = basic_color('92')
35light_yellow = basic_color('93')
36light_blue = basic_color('94')
37light_magenta = basic_color('95')
38light_cyan = basic_color('96')
39white = basic_color('97')
6fa09c14 40
c075e6dc
O
41on_default = basic_color('49')
42on_black = basic_color('40')
43on_red = basic_color('41')
44on_green = basic_color('42')
45on_yellow = basic_color('43')
46on_blue = basic_color('44')
47on_magenta = basic_color('45')
48on_cyan = basic_color('46')
49on_grey = basic_color('100')
50on_light_red = basic_color('101')
51on_light_green = basic_color('102')
52on_light_yellow = basic_color('103')
53on_light_blue = basic_color('104')
6fa09c14 54on_light_magenta = basic_color('105')
c075e6dc
O
55on_light_cyan = basic_color('106')
56on_white = basic_color('107')