Add option to set soft divider highlighting group

Closes #89.
This commit is contained in:
Kim Silkebækken 2013-01-22 11:26:33 +01:00
parent 424f979136
commit 3703514ed7
2 changed files with 6 additions and 1 deletions

View File

@ -96,7 +96,9 @@ class Renderer(object):
segment_hl = ''
if render_highlighted:
if divider_type == 'hard':
if divider_type == 'soft' and segment['divider_highlight_group'] is not None:
divider_hl = self.hl(segment['divider_highlight'][mode]['fg'], segment['divider_highlight'][mode]['bg'], False)
elif divider_type == 'hard':
divider_hl = self.hl(segment['highlight'][mode]['bg'], compare_segment['highlight'][mode]['bg'], False)
segment_hl = self.hl(**segment['highlight'][mode])

View File

@ -35,11 +35,14 @@ class Segment(object):
raise TypeError('Unknown segment type: {0}'.format(segment_type))
contents, contents_func, key = get_segment_info(segment)
highlight_group = segment.get('highlight_group', segment.get('name'))
divider_highlight_group = segment.get('divider_highlight_group')
return {
'key': key,
'type': segment_type,
'highlight_group': highlight_group,
'highlight': self.colorscheme.get_group_highlighting(highlight_group),
'divider_highlight_group': divider_highlight_group,
'divider_highlight': self.colorscheme.get_group_highlighting(divider_highlight_group) if divider_highlight_group else None,
'before': segment.get('before', ''),
'after': segment.get('after', ''),
'contents_func': contents_func,