Added support for truecolor in tmux status line

This commit is contained in:
Alex Maese 2018-02-13 10:27:31 -06:00
parent a4a1c83539
commit b53708b577
2 changed files with 12 additions and 3 deletions

View File

@ -163,6 +163,9 @@ def init_tmux_environment(pl, args, set_tmux_environment=set_tmux_environment):
(attr for attr in attrs if not attr.startswith('no'))) (attr for attr in attrs if not attr.startswith('no')))
# But it does not support empty attributes as well. # But it does not support empty attributes as well.
or 'none')) or 'none'))
else:
if powerline.common_config['term_truecolor'] is True:
set_tmux_environment(varname, '#{0:06x}'.format(get_highlighting(group)[attr][1]))
else: else:
set_tmux_environment(varname, 'colour' + str(get_highlighting(group)[attr][0])) set_tmux_environment(varname, 'colour' + str(get_highlighting(group)[attr][0]))

View File

@ -47,11 +47,17 @@ class TmuxRenderer(Renderer):
if fg is not None: if fg is not None:
if fg is False or fg[0] is False: if fg is False or fg[0] is False:
tmux_attrs += ['fg=default'] tmux_attrs += ['fg=default']
else:
if self.term_truecolor and fg[1]:
tmux_attrs += ['fg=#{0:06x}'.format(int(fg[1]))]
else: else:
tmux_attrs += ['fg=colour' + str(fg[0])] tmux_attrs += ['fg=colour' + str(fg[0])]
if bg is not None: if bg is not None:
if bg is False or bg[0] is False: if bg is False or bg[0] is False:
tmux_attrs += ['bg=default'] tmux_attrs += ['bg=default']
else:
if self.term_truecolor and bg[1]:
tmux_attrs += ['bg=#{0:06x}'.format(int(bg[1]))]
else: else:
tmux_attrs += ['bg=colour' + str(bg[0])] tmux_attrs += ['bg=colour' + str(bg[0])]
if attrs is not None: if attrs is not None: