X-Git-Url: https://vcs.fsf.org/?p=rainbowstream.git;a=blobdiff_plain;f=rainbowstream%2Frainbow.py;h=0c0602ceead9c2197a8be62b41da3600767f8937;hp=d31533b029f6dbfe579a71cd0f024e8a24e55e5d;hb=9bc91c782dd597aa37655876436abd1367e441ca;hpb=9c7342ca2f74dcafad845ca0010013181e2ca16f diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index d31533b..0c0602c 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -780,7 +780,7 @@ def theme(): os.environ.get('USERPROFILE', '')) + os.sep + '.rainbow_config.json' if not os.path.exists(custom_path): - line += light_magenta(' (create your own config at ~/.rainbow_config.json)') + line += light_magenta(' (create your own config file at ~/.rainbow_config.json)') else: line += light_magenta(' (loaded)') else: @@ -794,20 +794,29 @@ def theme(): # Change theme try: # Load new config - new_config = 'rainbowstream/colorset/' + g['stuff'] + '.json' + c['theme'] = g['stuff'] + if g['stuff'] != 'custom': + new_config = 'rainbowstream/colorset/' + g['stuff'] + '.json' + else: + new_config = os.environ.get( + 'HOME',os.environ.get( + 'USERPROFILE', + '')) + os.sep + '.rainbow_config.json' new_config = load_config(new_config) if new_config: for nc in new_config: c[nc] = new_config[nc] # Update db and reset colors db.theme_update(g['stuff']) - cyc = init_cycle() g['decorated_name'] = color_func( c['DECORATED_NAME'])( '[@' + g['original_name'] + ']: ') printNicely(green('Theme changed.')) except: - printNicely(red('Sorry, can not load config file!')) + if g['stuff'] == 'custom': + printNicely(light_magenta('~/.rainbow_config.json is not exists!')) + else: + printNicely(red('No such theme exists.')) def help():