bumped v0.1.6
[rainbowstream.git] / rainbowstream / rainbow.py
index d69f6026f3c11a183d2d6f2d32ff79ae4a3625d5..98aa05fba3da2a6c2531ea10c9e6057b641dcfcb 100644 (file)
@@ -137,7 +137,7 @@ def get_decorated_name():
     g['decorated_name'] = color_func(c['DECORATED_NAME'])('[' + name + ']: ')
     g['ascii_art'] = True
 
-    files = os.listdir('rainbowstream/colorset')
+    files = os.listdir(os.path.dirname(__file__)+'/colorset')
     themes = [f.split('.')[0] for f in files if f.split('.')[-1] == 'json']
     themes += ['custom']
     g['themes'] = themes
@@ -794,9 +794,8 @@ def theme():
         # Change theme
         try:
             # Load new config
-            c['theme'] = g['stuff']
             if g['stuff'] != 'custom':
-                new_config = 'rainbowstream/colorset/' + g['stuff'] + '.json'
+                new_config = os.path.dirname(__file__) + '/colorset/' + g['stuff'] + '.json'
             else:
                 new_config = os.environ.get(
                     'HOME',os.environ.get(
@@ -808,6 +807,7 @@ def theme():
                     c[nc] = new_config[nc]
             # Update db and reset colors
             db.theme_update(g['stuff'])
+            c['theme'] = g['stuff']
             notify_cycle()
             g['decorated_name'] = color_func(
                 c['DECORATED_NAME'])(
@@ -815,7 +815,7 @@ def theme():
             printNicely(green('Theme changed.'))
         except:
             if g['stuff'] == 'custom':
-                printNicely(light_magenta('~/.rainbow_config.json is not exists!'))
+                printNicely(red('~/.rainbow_config.json is not exists!'))
             else:
                 printNicely(red('No such theme exists.'))