fix pull request 2
[rainbowstream.git] / rainbowstream / draw.py
index a44450cc0486ea1188ae7ed640f1cde39c8d36a1..27cc8746865e784f97d0bace7289831c9f734423 100644 (file)
@@ -24,13 +24,20 @@ 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)
 g['cyc'] = init_cycle()
 
 
+def notify_cycle():
+    """
+    Notify from rainbow
+    """
+    g['cyc'] = init_cycle()
+
+
 def order_rainbow(s):
     """
     Print a string with ordered color with each character
@@ -94,7 +101,7 @@ def check_theme():
                 os.environ.get('USERPROFILE',
                 '')) + os.sep + '.rainbow_config.json'
         else:
-            config = 'rainbowstream/colorset/'+c['theme']+'.json'
+            config = os.path.dirname(__file__) + '/colorset/'+c['theme']+'.json'
         # Load new config
         data = load_config(config)
         if data:
@@ -109,8 +116,8 @@ 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]