from .config import *
from .db import *
-
db = RainbowDB()
+g = {}
+
def init_cycle():
"""
Init the cycle
"""
colors_shuffle = [globals()[i.encode('utf8')]
- if not i.startswith('RGB_')
- else RGB(int(i[4:]))
+ if not i.startswith('term_')
+ else term_color(int(i[5:]))
for i in c['CYCLE_COLOR']]
return itertools.cycle(colors_shuffle)
-cyc = init_cycle()
+g['cyc'] = init_cycle()
+
+
+def notify_cycle():
+ """
+ Notify from rainbow
+ """
+ g['cyc'] = init_cycle()
+
def order_rainbow(s):
"""
"""
Cycle the colors_shuffle
"""
- return next(cyc)(s)
+ return next(g['cyc'])(s)
def ascii_art(text):
"""
fi = figlet_format(text, font='doom')
print('\n'.join(
- [next(cyc)(i) for i in fi.split('\n')]
+ [next(g['cyc'])(i) for i in fi.split('\n')]
))
for d in data:
c[d] = data[d]
# Re-init color cycle
- cyc = init_cycle()
+ g['cyc'] = init_cycle()
def color_func(func_name):
Call color function base on name
"""
pure = func_name.encode('utf8')
- if pure.startswith('RGB_') and pure[4:].isdigit():
- return RGB(int(pure[4:]))
+ if pure.startswith('term_') and pure[5:].isdigit():
+ return term_color(int(pure[5:]))
return globals()[pure]