Fix checks for gradient groups (it was not forcing gradient colors)

This commit is contained in:
ZyX 2013-03-24 01:19:58 +04:00
parent 157b849d33
commit 37b684dcd3
1 changed files with 3 additions and 3 deletions

View File

@ -687,7 +687,7 @@ def hl_exists(hl_group, data, context, echoerr, allow_gradients=False):
for colorscheme, cconfig in data['colorscheme_configs'][ext].items(): for colorscheme, cconfig in data['colorscheme_configs'][ext].items():
if hl_group not in cconfig.get('groups', {}): if hl_group not in cconfig.get('groups', {}):
r.append(colorscheme) r.append(colorscheme)
elif not allow_gradients: elif not allow_gradients or allow_gradients == 'force':
group_config = cconfig['groups'][hl_group] group_config = cconfig['groups'][hl_group]
hadgradient = False hadgradient = False
for ckey in ('fg', 'bg'): for ckey in ('fg', 'bg'):
@ -704,14 +704,14 @@ def hl_exists(hl_group, data, context, echoerr, allow_gradients=False):
hadgradient = True hadgradient = True
if allow_gradients is False and not hascolor and hasgradient: if allow_gradients is False and not hascolor and hasgradient:
echoerr(context='Error while checking highlight group in theme (key {key})'.format(key=context_key(context)), echoerr(context='Error while checking highlight group in theme (key {key})'.format(key=context_key(context)),
context_mark=hl_group.mark, context_mark=getattr(hl_group, 'mark', None),
problem='group {0} is using gradient {1} instead of a color'.format(hl_group, color), problem='group {0} is using gradient {1} instead of a color'.format(hl_group, color),
problem_mark=color.mark) problem_mark=color.mark)
r.append(colorscheme) r.append(colorscheme)
continue continue
if allow_gradients == 'force' and not hadgradient: if allow_gradients == 'force' and not hadgradient:
echoerr(context='Error while checking highlight group in theme (key {key})'.format(key=context_key(context)), echoerr(context='Error while checking highlight group in theme (key {key})'.format(key=context_key(context)),
context_mark=hl_group.mark, context_mark=getattr(hl_group, 'mark', None),
problem='group {0} should have at least one gradient color, but it has no'.format(hl_group), problem='group {0} should have at least one gradient color, but it has no'.format(hl_group),
problem_mark=group_config.mark) problem_mark=group_config.mark)
r.append(colorscheme) r.append(colorscheme)