Reputation: 1676
Color scheme is gruvbox
.
without tmux:
with tmux:
I tried
set -g default-terminal "screen-256color"
and
set -g default-terminal "tmux-256color"
in .tmux.conf
, none worked.
Upvotes: 1
Views: 1565
Reputation: 186
Try to use the same configuration that @scupit but without the -
inside the quotation marks. I mean: set -ga terminal-overrides ",*256col*:Tc"
Upvotes: 1
Reputation: 844
According to this unix.stackexchange post, you should also add this line in your .tmux.conf:
set-option -ga terminal-overrides ",*-256color*:TC"
The accepted answer in the above link already has a good explanation of why this is the case, so I'll just summarize:
default-terminal
is the configuration used by the terminals emulated inside tmux. terminal-overrides
is the configuration used by tmux to communicate with the actual terminal it's running in (we'll call that the parent terminal). In your case, just setting default-terminal
to use "screen256-color" isn't enough because tmux will still communicate with its parent terminal using a limited color set. Additionally setting terminal-overrides
to also use "256 color" means that tmux will both use the expanded color set internally, and will tell its parent terminal to render in that expanded color set.
# Tell tmux to use 256-color internally
set -g default-terminal "screen-256color"
# Allow tmux to send 256-color to its "parent terminal", allowing
# the terminal to render colors in full.
set-option -ga terminal-overrides ",*-256color*:TC"
The reason tmux -2
works is because it does essentially the same thing. man tmux
contains this description of the -2
flag:
-2 Force tmux to assume the terminal supports 256 colours.
which is essentially what we did when setting terminal-overrides
. Assuming the parent terminal supports 256 colors means tmux will send information to be rendered in the 256 color set instead of whatever limited color set it is defaulting to.
Upvotes: 4