When you switch terminal themes, your prompt and UI colors might change—unless you tell tmux exactly which colors to use. tmux lets you bypass theme-dependent names like red or blue and instead target fixed palette indexes (or even truecolor) so your status bar and panes look the same everywhere.
Use numeric color indices (or RGB) instead of theme names. In tmux, that means:
colourNfor the 256-color palette (0–255)#RRGGBBfor truecolor (24-bit), if your terminal supports it
These don’t depend on your terminal’s color scheme, so your tmux UI stays consistent.
set -g status-style fg=colour231,bg=colour34colour231is near-whitecolour34is a medium/bright green
This pins the status bar to white text on green, regardless of the terminal theme.
Add to ~/.tmux.conf:
# Status bar: white on green, theme-proof
set -g status on
set -g status-style fg=colour231,bg=colour34Reload your config:
tmux source-file ~/.tmux.confPin colors for specific segments or panes the same way:
# Left/right status segments
set -g status-left "#[fg=colour16,bg=colour190,bold] #S #[default]"
set -g status-right "#[fg=colour231,bg=colour60] %Y-%m-%d %H:%M #[default]"
# Active/inactive window styles
set -g window-status-current-style fg=colour16,bg=colour190
set -g window-status-style fg=colour188,bg=colour237
# Pane borders
set -g pane-border-style fg=colour238
set -g pane-active-border-style fg=colour40Tip: Always include
#[default]when you’re done styling inline segments so tmux resets formatting for whatever follows.
-
256-color (
colourN) works everywhere tmux does and is deterministic across terminals. -
Truecolor (
#RRGGBB) gives exact shades:set -g status-style fg=#ffffff,bg=#1db954
Ensure your terminal and tmux support it. Most modern terminals do.
-
Use a truecolor-capable terminal (iTerm2, Alacritty, WezTerm, recent Windows Terminal, etc.).
-
Prefer
TERMlikexterm-256coloroutside tmux, and let tmux setscreen-256colorortmux-256colorinside. Avoid exoticTERMvalues. -
If colors look off, try:
set -ga terminal-overrides ",*:Tc"
This advertises 24-bit color to tmux.
If you want a specific shade but stick to 256 colors, preview the palette:
# Quick 0–255 palette preview
for i in {0..255}; do printf "%3d \x1b[48;5;%sm \x1b[0m" $i $i;
if ! (( (i+1) % 8 )); then echo; fi;
donePick the index you like and plug it into colourN.
- Theme names vs indices:
fg=redcan vary by theme;fg=colour196will not. - Forgetting resets: Inline status strings (
status-left/right) need#[default]to avoid “color leaks.” - Wrong
$TERM: Values likexterm(no-256color) can reduce color fidelity. Usexterm-256colorin your shell and let tmux handle its own$TERM. - Remote sessions: Over SSH, ensure the remote environment also supports 256/24-bit colors (same
$TERM, similar overrides).
# Status bar
set -g status on
set -g status-style fg=colour231,bg=colour34
# Windows
set -g window-status-current-style fg=colour16,bg=colour190
set -g window-status-style fg=colour250,bg=colour238
# Panes
set -g pane-active-border-style fg=colour40
set -g pane-border-style fg=colour238
# Optional: truecolor enable (if your terminal supports it)
set -ga terminal-overrides ",*:Tc"With numeric indices—or explicit #RRGGBB—your tmux colors will stay consistent no matter which terminal theme you use.