84e3ad846a399ab1f5d34b8b624a2d173f694e9c
1 import random
, itertools
2 from functools
import wraps
3 from termcolor
import *
4 from pyfiglet
import figlet_format
6 grey
= lambda x
: colored(x
, 'grey', attrs
=['bold'])
7 red
= lambda x
: colored(x
, 'red', attrs
=['bold'])
8 green
= lambda x
: colored(x
, 'green', attrs
=['bold'])
9 yellow
= lambda x
: colored(x
, 'yellow', attrs
=['bold'])
10 blue
= lambda x
: colored(x
, 'blue', attrs
=['bold'])
11 magenta
= lambda x
: colored(x
, 'magenta', attrs
=['bold'])
12 cyan
= lambda x
: colored(x
, 'cyan', attrs
=['bold'])
13 white
= lambda x
: colored(x
, 'white', attrs
=['bold'])
15 on_grey
= lambda x
: colored(x
, 'white', 'on_grey', attrs
=['bold'])
16 on_red
= lambda x
: colored(x
, 'white', 'on_red', attrs
=['bold'])
17 on_green
= lambda x
: colored(x
, 'white', 'on_green', attrs
=['bold'])
18 on_yellow
= lambda x
: colored(x
, 'white', 'on_yellow', attrs
=['bold'])
19 on_blue
= lambda x
: colored(x
, 'white', 'on_blue', attrs
=['bold'])
20 on_magenta
= lambda x
: colored(x
, 'white', 'on_magenta', attrs
=['bold'])
21 on_cyan
= lambda x
: colored(x
, 'white', 'on_cyan', attrs
=['bold'])
22 on_white
= lambda x
: colored(x
, 'white', 'on_white', attrs
=['bold'])
24 colors_shufle
= [grey
, red
, green
, yellow
, blue
, magenta
, cyan
]
25 background_shufle
= [on_grey
, on_red
, on_green
, on_yellow
, on_blue
, on_magenta
, on_cyan
]
26 cyc
= itertools
.cycle(colors_shufle
[1:])
31 Print a string with ordered color with each character
33 c
= [colors_shufle
[i
%7](s
[i
]) for i
in xrange(len(s
))]
34 return reduce(lambda x
,y
: x
+y
, c
)
36 def random_rainbow(s
):
38 Print a string with random color with each character
40 c
= [random
.choice(colors_shufle
)(i
) for i
in s
]
41 return reduce(lambda x
,y
: x
+y
, c
)
51 cache
[args
] = func(*args
)
58 Cycle the colors_shufle
66 fi
= figlet_format('Rainbow Stream', font
='doom')
68 [next(cyc
)(i
) for i
in fi
.split('\n')]