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 = [locals()[i.encode('utf8')] if not i.startswith(
+ 'RGB_') else RGB(int(i[4:])) for i in c['CYCLE_COLOR']]
+ cyc = itertools.cycle(colors_shuffle)
+init_cycle()
def order_rainbow(s):
"""
http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
*/
- "DECORATED_NAME" : "RGB_166",
+ "DECORATED_NAME" : "RGB_198",
"CYCLE_COLOR" :["RGB_198","RGB_57","RGB_166","RGB_50","RGB_179","RGB_74","RGB_112"],
"TWEET" : {
- "nick" : "RGB_198",
+ "nick" : "RGB_112",
"clock" : "RGB_57",
"id" : "RGB_166",
"favourite" : "RGB_50",
},
"MESSAGE" : {
- "sender" : "RGB_198",
+ "sender" : "RGB_112",
"recipient" : "RGB_112",
"to" : "RGB_50",
"clock" : "RGB_57",
# Detect custom config
if theme == 'custom':
line += light_magenta('custom')
- exists = db.theme_query()
- themes = [t.theme_name for t in exists]
- if themes[0] == 'custom':
- line += light_magenta(' (applied)')
+ custom_path = os.environ.get(
+ 'HOME',
+ 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)')
else:
- line += light_magenta(' (not specified)')
+ line += light_magenta(' (loaded)')
else:
line += light_magenta(theme)
if c['theme'] == theme :
if new_config:
for nc in new_config:
c[nc] = new_config[nc]
- # Update db
+ # Update db and reset colors
db.theme_update(g['stuff'])
+ init_cycle()
g['decorated_name'] = color_func(
c['DECORATED_NAME'])(
'[@' + g['original_name'] + ']: ')
printNicely(green('Theme changed.'))
except:
- printNicely(red('Sorry, config file is broken!'))
+ printNicely(red('Sorry, can not load config file!'))
def help():