19

I would like different panes to appear in different background colors in my tmux session.
Is this possible?

2
  • Good answers already submitted. Note that you can make changes from the command line. The TMUX_PANE variable can identify different panes. Pres s the command key (Ctrl-B), a colon, and type "set -g " as StefanS suggests. e.g., Ctrl-B then ":set -g pane-active-border-bg magenta". Since his example and mine differ, maybe there are differences in tmux. Use "man tmux" and search for "colour". (Yeah, I'm American, but my copy of the man page has a "u" in the word. So search for colour, not color.)
    – TOOGAM
    Feb 13, 2015 at 6:42
  • 1
    see stackoverflow.com/questions/25532773/… Feb 29, 2016 at 18:47

4 Answers 4

23

You can set any pane's style using the select-pane -P command. You can combine this with other select-pane options for example

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

would set the first pane's background as red.

select-pane -P 'bg=red'

would set the current pane's background to red.

2
  • If anyone is wondering what -P stands for in this context, I think the answer is nothing in particular. In other places in tmux syntax, a "p" flag might stand for "parent", "pane" or "print", but none of those apply here, were "-P" is used to a set a style and it's "-t" that selects the pane. May 21, 2019 at 20:21
  • This is super nice - I use it to mark a pane as "root" (red or bright background color) if it has creds that are above norm
    – Brad Parks
    Mar 14, 2022 at 13:22
0

Unfortunately there is no obvious way to do it. I did a bit of research on the matter and what I ended up doing was changing the BASH prompt color instead of the background color. In my case it works well and helps me identify the different panes at a glance. Here are the two most helpful pages that I found on the subject:

Change The Color of My Shell Prompt

Cnange shell background color on ssh

I hope this helps you on your quest for knowledge :-)

1
  • Synopsizing the content of those linked documents would make this a much better answer. Feb 22, 2017 at 19:45
0

Maybe you can change your colors in your ~/.tmux.conf. You could specify colours like so:

# border colours

 set -g pane-border-style fg=magenta
 set -g pane-active-border-style fg=magenta 
 set -g pane-active-border-style bg=default
0

tmux-session-spectrum provides a way to do this for tmux sessions:

 git clone https://github.com/a-rodin/tmux-session-spectrum  \
  "${HOME}/.tmux/plugins/tmux-session-spectrum"

In ~/.tmux-conf:

set-hook -g after-new-session "run-shell 'bash ~/.tmux/plugins/tmux-session-spectrum/tmux-session-spectrum.sh'"

This can be tweaked to run per-pane instead of per-session.

1
  • Can you describe the 'tweak' you would make to cause this to work on a per-pane basis? The plug-in itself only talks about changing the status bar from session to session.
    – iconoclast
    Mar 19, 2022 at 4:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .