include README.rst
include rainbowstream/image.c
-include rainbowstream/consumer.pyc
recursive-include rainbowstream/colorset *.json
import os
import os.path
-
# Regular expression for comments
comment_re = re.compile(
'(^)?[^\S\n]*/(?:\*(.*?)\*/[^\S\n]*|/[^\n]*)($)?',
match = comment_re.search(content)
return json.loads(content)
-# Load default colorset
+# Config dictionary
c = {}
+# Load default
default_config = os.path.dirname(__file__) + '/colorset/default.json'
data = load_config(default_config)
for d in data:
c[d] = data[d]
c['theme'] = 'default'
+# Load init if exist
+try:
+ path = os.path.dirname(__file__) + '/colorset/init'
+ f = open(path)
+ lines = f.readlines()
+ if len(lines) > 1:
+ raise Exception('More than 1 default theme')
+ theme_name = lines[0].strip()
+ default_config = os.path.dirname(__file__)+'/colorset/'+theme_name+'.json'
+ data = load_config(default_config)
+ for d in data:
+ c[d] = data[d]
+ c['theme'] = theme_name
+ f.close()
+except:
+ pass
# Load user's colorset
rainbow_config = os.environ.get(
'HOME',
else:
line = ' '*4 + line
printNicely(line)
+ elif g['stuff'] == 'current_as_default':
+ path = os.path.dirname(__file__) + '/colorset/init'
+ f = open(path,'w')
+ f.write(c['theme'])
+ f.close()
+ printNicely(light_green('Okay it will be applied from next time :)'))
else:
# Change theme
try:
['@'], # unblock
['@'], # report
[], # cal
- g['themes'], # theme
+ g['themes'] + ['current_as_default'], # theme
[], # help
[], # clear
[], # quit