问题
Following the upgrade to tmux version 2.9a, I had to update my configuration file as some of the settings had name changes. The colors for the window title section of my status bar no longer work. Here is that part of my configuration file:
# set color for status bar
set-option -g status-style bg=colour235
set-option -g status-style fg=yellow
set-option -g status-style dim
# set window title list colors
set-window-option -g window-status-style fg=brightblue
set-window-option -g window-status-style bg=colour236
set-window-option -g window-status-style dim
# active window title colors
set-window-option -g window-status-current-style fg=brightred
set-window-option -g window-status-current-style bg=colour236
set-window-option -g window-status-current-style bright
No matter what colors or brightness I select the title area of the status bar shows white text. My entire tmux configuration file is here: https://github.com/zanshin/dotfiles/blob/master/tmux/tmux.conf
回答1:
If you set an option multiple times, the last value will be the one used.
You need to set each option once or use -a on the second and subsequent set commands for each option.
回答2:
The syntax has changed slightly (I like the new one). You can now put multiple attribute on the same line separated with a comma.
With the new syntax, the configuration you've in your question became:
# set color for status bar
set-option -g status-style bg=colour235,fg=yellow,dim
# set window title list colors
set-window-option -g window-status-style fg=brightblue,bg=colour236,dim
# active window title colors
set-window-option -g window-status-current-style fg=brightred,bg=colour236,bright
For additiona information you can refer to tmux's FAQ
回答3:
Print Default Setting Values
tmux -Lfoo -f/dev/null start\; show -gw
Print Current Setting Values
tmux -Lfoo -f/dev/null start\; show -g
Default Window Options 2.9.a
window-active-style default
window-size smallest
window-status-activity-style reverse
window-status-bell-style reverse
window-status-current-format "#I:#W#{?window_flags,#{window_flags}, }"
window-status-current-style default
window-status-format "#I:#W#{?window_flags,#{window_flags}, }"
window-status-last-style default
window-status-separator " "
window-status-style default
window-style default
Suggestions On Modifications
These colors are just for seeing differences
~/.tmux.conf
# ------------- #
# Define Colors #
# ------------- #
GRAY="#808080"
BLUE="#569CD6"
DARK_BLUE="223E55"
RED="#EE4646"
YELLOW="#CCCC99"
BACKGROUND="#000000"
FOREGROUND="#CCCCCC"
# ----------------- #
# Define Status Bar #
# ----------------- #
set -g status-interval 1
set -g status-style bg=$BACKGROUND,fg=$BLUE
# ------------ #
# Define Panes #
# ------------ #
set -g pane-border-style fg=$DARK_BLUE
set -g pane-active-border-style fg=$BLUE
# ---------------- #
# Define Left Side #
# ---------------- #
set -g status-left " "
# -------------- #
# Define Windows #
# -------------- #
set -g window-status-current-format "#[fg=$BLUE] ➤ "
set -g window-status-format " ➤ "
set -g window-status-activity-style fg=$RED
set -g window-status-bell-style fg=$YELLOW
set -g window-status-separator " "
set -g window-style default
set -g window-status-style bg=$BACKGROUND,fg=$GRAY
# ----------------- #
# Define Right Side #
# ----------------- #
set -g status-right-length 150
set -g status-right "#T %Y-%m-%d %H:%M:%S "
来源:https://stackoverflow.com/questions/56060443/how-do-i-set-window-title-color-in-tmux-2-9a