diff --git a/powerline/bindings/config.py b/powerline/bindings/config.py index f0617f10..529cdb1f 100644 --- a/powerline/bindings/config.py +++ b/powerline/bindings/config.py @@ -164,7 +164,10 @@ def init_tmux_environment(pl, args, set_tmux_environment=set_tmux_environment): # But it does not support empty attributes as well. or 'none')) else: - set_tmux_environment(varname, 'colour' + str(get_highlighting(group)[attr][0])) + if powerline.common_config['term_truecolor'] is True: + set_tmux_environment(varname, '#{0:06x}'.format(get_highlighting(group)[attr][1])) + else: + set_tmux_environment(varname, 'colour' + str(get_highlighting(group)[attr][0])) left_dividers = powerline.renderer.theme.dividers['left'] set_tmux_environment('_POWERLINE_LEFT_HARD_DIVIDER', left_dividers['hard']) diff --git a/powerline/renderers/tmux.py b/powerline/renderers/tmux.py index 840bbdda..ee6c09c2 100644 --- a/powerline/renderers/tmux.py +++ b/powerline/renderers/tmux.py @@ -48,12 +48,18 @@ class TmuxRenderer(Renderer): if fg is False or fg[0] is False: tmux_attrs += ['fg=default'] else: - tmux_attrs += ['fg=colour' + str(fg[0])] + if self.term_truecolor and fg[1]: + tmux_attrs += ['fg=#{0:06x}'.format(int(fg[1]))] + else: + tmux_attrs += ['fg=colour' + str(fg[0])] if bg is not None: if bg is False or bg[0] is False: tmux_attrs += ['bg=default'] else: - tmux_attrs += ['bg=colour' + str(bg[0])] + if self.term_truecolor and bg[1]: + tmux_attrs += ['bg=#{0:06x}'.format(int(bg[1]))] + else: + tmux_attrs += ['bg=colour' + str(bg[0])] if attrs is not None: tmux_attrs += attrs_to_tmux_attrs(attrs) return '#[' + ','.join(tmux_attrs) + ']'