Rename colorscheme variable to colorscheme_config

This commit is contained in:
ZyX 2013-02-22 23:22:00 +04:00 committed by Kim Silkebækken
parent d9943e3222
commit 41ffd8cf5a
1 changed files with 4 additions and 4 deletions

View File

@ -7,20 +7,20 @@ ATTR_UNDERLINE = 4
class Colorscheme(object): class Colorscheme(object):
def __init__(self, colorscheme): def __init__(self, colorscheme_config):
'''Initialize a colorscheme.''' '''Initialize a colorscheme.'''
self.colors = {} self.colors = {}
self.modes_groups = {DEFAULT_MODE_KEY: {}} self.modes_groups = {DEFAULT_MODE_KEY: {}}
# Create a dict of color tuples with both a cterm and hex value # Create a dict of color tuples with both a cterm and hex value
for color_name, color in colorscheme['colors'].items(): for color_name, color in colorscheme_config['colors'].items():
try: try:
self.colors[color_name] = (color[0], int(color[1], 16)) self.colors[color_name] = (color[0], int(color[1], 16))
except TypeError: except TypeError:
self.colors[color_name] = (color, cterm_to_hex[color]) self.colors[color_name] = (color, cterm_to_hex[color])
# Create highlighting groups for all modes # Create highlighting groups for all modes
for group_name, group_props in colorscheme['groups'].items(): for group_name, group_props in colorscheme_config['groups'].items():
group_attr_flag = self._get_attr_flag(group_props.get('attr', [])) group_attr_flag = self._get_attr_flag(group_props.get('attr', []))
self.modes_groups[DEFAULT_MODE_KEY][group_name] = { self.modes_groups[DEFAULT_MODE_KEY][group_name] = {
'fg': self.colors[group_props['fg']], 'fg': self.colors[group_props['fg']],
@ -29,7 +29,7 @@ class Colorscheme(object):
} }
# Create mode-specific highlighting for this group # Create mode-specific highlighting for this group
for mode, translations in colorscheme.get('mode_translations', {}).items(): for mode, translations in colorscheme_config.get('mode_translations', {}).items():
if not mode in self.modes_groups: if not mode in self.modes_groups:
self.modes_groups[mode] = {} self.modes_groups[mode] = {}
if group_name in translations.get('groups', {}): if group_name in translations.get('groups', {}):