I'd like to change the background color of selections in Tmux. Which variable do I change for this?
There's more than one "selection":
tmux has selections for its paste, etc, while the terminal has its select/paste which
tmux knows nothing about:
- For the former, that's tied to the default colors which
tmuxuses, and there is no special configuration feature that lets you color it differently (see for example Turn off color inversion for marked pane in tmux).
- For the latter, that is terminal-dependent and not all terminals let you color the selection specially (see for example xterm highlighting always white, not reverse).
In most terminals the selection color is generated by reverse video. This implies that you cannot set it. It is just swapped background and foreground color.
It is probably the responsibility of the terminal application, you use to set up the colors for the the contents. The exception is of course what tmux renders for its own elements (bars, borders, its own prompt, etc).
foreground properties for your terminal and set them up in your
~/.Xdefaults file. On non-X terminals the termcap or certain environment variables files can be used for this.
You can change the styling of the text selection in tmux's copy mode by setting the
As of tmux version 3.2, the
mode-style option has a default value of
I prefer my text selection to use the reverse video style (my terminal's configured default foreground and background colors reversed).
To achieve that styling for the text selection within tmux, I have the following line in my
set -g mode-style 'reverse'