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