fix table_def
[rainbowstream.git] / rainbowstream / rainbow.py
index ce5d99898171f1230bbc691782efb0782b3bd91f..96d2f562bf162707f8308bbff77129331f9930ea 100644 (file)
@@ -139,6 +139,7 @@ def get_decorated_name():
 
     files = os.listdir('rainbowstream/colorset')
     themes = [f.split('.')[0] for f in files if f.split('.')[-1] == 'json']
+    themes += ['user']
     g['themes'] = themes
 
 
@@ -768,8 +769,19 @@ def theme():
     """
     if not g['stuff']:
         # List themes
+        line = ' ' * 2 + light_yellow('* ')
         for theme in g['themes']:
-            line = ' ' * 2 + light_yellow('* ' + theme)
+            # Detect custom config
+            if theme == 'user':
+                line += light_magenta('custom')
+                exists = db.theme_query()
+                themes = [t.theme_name for t in exists]
+                if themes[0] == 'user':
+                    line += light_magenta(' (applied)')
+                else:
+                    line += light_magenta(' (not specified)')
+            else:
+                line += light_magenta(theme)
             printNicely(line)
     else:
         # Change theme
@@ -777,12 +789,11 @@ def theme():
             # Load new config
             new_config = 'rainbowstream/colorset/' + g['stuff'] + '.json'
             new_config = load_config(new_config)
-            for nc in new_config:
-                c[nc] = new_config[nc]
-            # Reset stream
-            g['stuff'] = 'mine'
-            g['ascii_art'] = False
-            switch()
+            if new_config:
+                for nc in new_config:
+                    c[nc] = new_config[nc]
+            # Update db
+            theme_update(g['stuff'])
             g['decorated_name'] = color_func(
                 c['DECORATED_NAME'])(
                 '[@' + g['original_name'] + ']: ')