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