Changing the background color of an active or inactive panel in Tmux

Are there any options for controlling the background color of active or inactive panels in Tmux?

+37
tmux
Aug 27 '14 at 16:48
source share
2 answers

It seems that tmux-2.1 (released October 18, 2015) now allows you to specify the colors of individual panels. From the change log :

* 'select-pane' now understands '-P' to set window/pane background colours. 

for example, [from the manual] to change the foreground of panel 1 (text) to blue and the background to red:

 select-pane -t:.1 -P 'fg=blue,bg=red' 

To simulate the iTerm color scheme:

To answer the original question, I use the following lines in my ~/.tmux.conf to set the background / foreground colors to mimic the behavior in iTerm :

 #set inactive/active window styles set -g window-style 'fg=colour247,bg=colour236' set -g window-active-style 'fg=colour250,bg=black' # set the pane border colors set -g pane-border-fg colour235 set -g pane-border-bg colour238 set -g pane-active-border-fg colour236 set -g pane-active-border-bg colour250 #or if you a brighter active border, uncomment the following line: #set -g pane-active-border-bg colour51 

I have not seen the window-style and window-active-style commands before, but maybe they were available in previous versions of tmux.

In addition, these two lines are very useful for simple separation of panels:

 bind | split-window -h bind - split-window -v 

EDIT : as Jamie Schembri mentions in the comments, tmux version 2.1 (at least) will now be installed with:

 brew install tmux 

EDIT (October 2017) : brew now installs tmux 2.6, and the above still works.

EDIT Vim panels : If you find that inactive coloring does not work with the Vim panel, this may be due to the color scheme you are using. Try the pablo scheme; i.e. in the Vim panel:

 :colo pablo 

To make it work with your own custom Vim color ctermbg , make sure that the " Normal selection" parameter is not ctermbg or guibg . For example, "inactive coloring" does not work with murphy , because there is a line in murphy.vim :

 hi Normal ctermbg=Black ctermfg=lightgreen guibg=Black guifg=lightgreen 

this installs ctermbg or guibg to Black . However, changing this line to:

 hi Normal ctermfg=lightgreen guifg=lightgreen 

make "inactive coloring" work.

EDIT July 2019 Augusto provided a good suggestion for changing the background color for line numbers. In my vim colourscheme, I use the following:

 hi Normal guifg=#e6e1de ctermfg=none gui=none hi LineNr guifg=#e6e1de ctermfg=none gui=none 
+75
Nov 05 '15 at 19:41
source share

It is not possible to change the background color of the panel, but it is possible to set the border color (style) of the panel

  pane-active-border-style style Set the pane border style for the currently active pane. For how to specify style, see the message-command-style option. Attributes are ignored. pane-border-style style Set the pane border style for paneas aside from the active pane. For how to specify style, see the message-command-style option. Attributes are ignored. 
+4
Aug 27 '14 at 17:05
source share



All Articles