projects
/
rainbowstream.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f3aa6b6
)
fix typo
author
Orakaro
<nhatminh_179@hotmail.com>
Tue, 6 May 2014 07:52:31 +0000
(16:52 +0900)
committer
Orakaro
<nhatminh_179@hotmail.com>
Tue, 6 May 2014 07:52:31 +0000
(16:52 +0900)
rainbowstream/colors.py
patch
|
blob
|
blame
|
history
diff --git
a/rainbowstream/colors.py
b/rainbowstream/colors.py
index
84e3ad8
..
4a214d0
100644
(file)
--- a/
rainbowstream/colors.py
+++ b/
rainbowstream/colors.py
@@
-21,23
+21,23
@@
on_magenta = lambda x: colored(x, 'white', 'on_magenta', attrs=['bold'])
on_cyan = lambda x: colored(x, 'white', 'on_cyan', attrs=['bold'])
on_white = lambda x: colored(x, 'white', 'on_white', attrs=['bold'])
on_cyan = lambda x: colored(x, 'white', 'on_cyan', attrs=['bold'])
on_white = lambda x: colored(x, 'white', 'on_white', attrs=['bold'])
-colors_shufle = [grey, red, green, yellow, blue, magenta, cyan]
-background_shufle = [on_grey, on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan]
-cyc = itertools.cycle(colors_shufle[1:])
+colors_shuf
f
le = [grey, red, green, yellow, blue, magenta, cyan]
+background_shuf
f
le = [on_grey, on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan]
+cyc = itertools.cycle(colors_shuf
f
le[1:])
def order_rainbow(s):
"""
Print a string with ordered color with each character
"""
def order_rainbow(s):
"""
Print a string with ordered color with each character
"""
- c = [colors_shufle[i%7](s[i]) for i in xrange(len(s))]
+ c = [colors_shuf
f
le[i%7](s[i]) for i in xrange(len(s))]
return reduce(lambda x,y: x+y, c)
def random_rainbow(s):
"""
Print a string with random color with each character
"""
return reduce(lambda x,y: x+y, c)
def random_rainbow(s):
"""
Print a string with random color with each character
"""
- c = [random.choice(colors_shufle)(i) for i in s]
+ c = [random.choice(colors_shuf
f
le)(i) for i in s]
return reduce(lambda x,y: x+y, c)
def Memoize(func):
return reduce(lambda x,y: x+y, c)
def Memoize(func):
@@
-55,7
+55,7
@@
def Memoize(func):
@Memoize
def cycle_color(s):
"""
@Memoize
def cycle_color(s):
"""
- Cycle the colors_shufle
+ Cycle the colors_shuf
f
le
"""
return next(cyc)(s)
"""
return next(cyc)(s)