cycle-color
[rainbowstream.git] / rainbowstream / colors.py
index 909a85af3e5fc0bcc9fc32dad41d0935ff4c70c7..628f6350d3116c45c29cd70a453f19ee1cffc8f1 100644 (file)
@@ -62,19 +62,14 @@ on_light_magenta = basic_color('105')
 on_light_cyan = basic_color('106')
 on_white = basic_color('107')
 
-colors_shuffle = [locals()[i.encode('utf8')] if not i.startswith(
-    'RGB_') else RGB(int(i[4:])) for i in c['CYCLE_COLOR']]
-
-background_shuffle = [
-    on_grey,
-    on_light_red,
-    on_light_green,
-    on_light_yellow,
-    on_light_blue,
-    on_light_magenta,
-    on_light_cyan]
-cyc = itertools.cycle(colors_shuffle[1:])
-
+def init_cycle():
+    colors_shuffle = [globals()[i.encode('utf8')]
+        if not i.startswith('RGB_')
+        else RGB(int(i[4:]))
+        for i in c['CYCLE_COLOR']]
+    return itertools.cycle(colors_shuffle)
+
+cyc = init_cycle()
 
 def order_rainbow(s):
     """