3 from functools
import wraps
4 from termcolor
import *
5 from pyfiglet
import figlet_format
6 from functools
import reduce
8 grey
= lambda x
: colored(x
, 'grey', attrs
=['bold'])
9 red
= lambda x
: colored(x
, 'red', attrs
=['bold'])
10 green
= lambda x
: colored(x
, 'green', attrs
=['bold'])
11 yellow
= lambda x
: colored(x
, 'yellow', attrs
=['bold'])
12 blue
= lambda x
: colored(x
, 'blue', attrs
=['bold'])
13 magenta
= lambda x
: colored(x
, 'magenta', attrs
=['bold'])
14 cyan
= lambda x
: colored(x
, 'cyan', attrs
=['bold'])
15 white
= lambda x
: colored(x
, 'white', attrs
=['bold'])
17 on_grey
= lambda x
: colored(x
, 'white', 'on_grey', attrs
=['bold'])
18 on_red
= lambda x
: colored(x
, 'white', 'on_red', attrs
=['bold'])
19 on_green
= lambda x
: colored(x
, 'white', 'on_green', attrs
=['bold'])
20 on_yellow
= lambda x
: colored(x
, 'white', 'on_yellow', attrs
=['bold'])
21 on_blue
= lambda x
: colored(x
, 'white', 'on_blue', attrs
=['bold'])
22 on_magenta
= lambda x
: colored(x
, 'white', 'on_magenta', attrs
=['bold'])
23 on_cyan
= lambda x
: colored(x
, 'white', 'on_cyan', attrs
=['bold'])
24 on_white
= lambda x
: colored(x
, 'white', 'on_white', attrs
=['bold'])
26 colors_shuffle
= [grey
, red
, green
, yellow
, blue
, magenta
, cyan
]
27 background_shuffle
= [
35 cyc
= itertools
.cycle(colors_shuffle
[1:])
40 Print a string with ordered color with each character
42 c
= [colors_shuffle
[i
% 7](s
[i
]) for i
in xrange(len(s
))]
43 return reduce(lambda x
, y
: x
+ y
, c
)
46 def random_rainbow(s
):
48 Print a string with random color with each character
50 c
= [random
.choice(colors_shuffle
)(i
) for i
in s
]
51 return reduce(lambda x
, y
: x
+ y
, c
)
63 cache
[args
] = func(*args
)
71 Cycle the colors_shuffle
80 fi
= figlet_format('Rainbow Stream', font
='doom')
82 [next(cyc
)(i
) for i
in fi
.split('\n')]