3 from functools
import wraps
4 from pyfiglet
import figlet_format
11 def inner(text
, bold
=True):
15 return "\033[%sm%s\033[0m" % (c
, text
)
25 return "\033[38;5;%sm%s\033[0m" % (c
, text
)
29 default
= basic_color('39')
30 black
= basic_color('30')
31 red
= basic_color('31')
32 green
= basic_color('32')
33 yellow
= basic_color('33')
34 blue
= basic_color('34')
35 magenta
= basic_color('35')
36 cyan
= basic_color('36')
37 grey
= basic_color('90')
38 light_red
= basic_color('91')
39 light_green
= basic_color('92')
40 light_yellow
= basic_color('93')
41 light_blue
= basic_color('94')
42 light_magenta
= basic_color('95')
43 light_cyan
= basic_color('96')
44 white
= basic_color('97')
46 on_default
= basic_color('49')
47 on_black
= basic_color('40')
48 on_red
= basic_color('41')
49 on_green
= basic_color('42')
50 on_yellow
= basic_color('43')
51 on_blue
= basic_color('44')
52 on_magenta
= basic_color('45')
53 on_cyan
= basic_color('46')
54 on_grey
= basic_color('100')
55 on_light_red
= basic_color('101')
56 on_light_green
= basic_color('102')
57 on_light_yellow
= basic_color('103')
58 on_light_blue
= basic_color('104')
59 on_light_magenta
= basic_color('105')
60 on_light_cyan
= basic_color('106')
61 on_white
= basic_color('107')
71 background_shuffle
= [
79 cyc
= itertools
.cycle(colors_shuffle
[1:])
84 Print a string with ordered color with each character
86 c
= [colors_shuffle
[i
% 7](s
[i
]) for i
in xrange(len(s
))]
87 return reduce(lambda x
, y
: x
+ y
, c
)
90 def random_rainbow(s
):
92 Print a string with random color with each character
94 c
= [random
.choice(colors_shuffle
)(i
) for i
in s
]
95 return reduce(lambda x
, y
: x
+ y
, c
)
106 if args
not in cache
:
107 cache
[args
] = func(*args
)
115 Cycle the colors_shuffle
124 fi
= figlet_format(text
, font
='doom')
126 [next(cyc
)(i
) for i
in fi
.split('\n')]