The problem
On my Mac (10.11) Tmux does not show dim
-ed colours properly, and this causes annoyance.
In the following picture, the commit author's name is supposed to be represented in dim white
. This works fine in the Terminal.app but not within Tmux.
Does anyone have any clue about how to debug this?
I believe it is related to the $TERM
variable, but I wouldn't know where to start.
In Terminal.app $TERM
is set to xterm-256color
.
In Tmux $TERM
is set to screen-256color
.
In my .tmux.conf
I have set -g default-terminal "screen-256color"
. xterm-256color
, within Tmux, conflicts with Vim's background colour, somehow, but doesn't change the dim
behaviour.
More information
I've open an issue on Tmux's GitHub repository; an answer has been provided, but I do not entirely understand it.
It looks like Terminal.app does not have a dim
directive, although it deals just fine with it.
Tmux cannot fetch the dim
information, since it is absent, and therefore it does not show the font properly.
Now I am not sure why one works whereas the other does not.
Best Answer
tmux
(like GNU screen) works by translating the features of your actual terminal into an (often different) internal terminal. They do this to allow you to connect a session on different terminals at the same time, or at different times.When that works well, you will see the "same" text no matter where you are connecting from.
Not all terminals support
dim
. As matter of fact, most do not. The terminal database has 121 occurrences ofdim
versus 1514 terminal descriptions.When
screen
was begun around 1990, its developers chose to ignore that feature and instead supply the most useful. They designed the program to store, for each row/column cell, the video attributes that termcap programs were likely to use. The source-code defines these:but both
screen
andtmux
use these internal features only if the external terminal supports them, as well as being provided in the internal terminal description.OSX bundles a copy of ncurses and the terminal database. While you could install MacPorts or homebrew and get a later version, what OSX has is
ncurses 5.7.20081102
. If you useinfocmp
to show the terminal descriptions you would see something like this:There is no
dim
there. In ncurses, this was added in April 2015:Likewise, you would not see
dim
in xterm-256color. That was added in June 2014:The manner in which
dim
is used in the external Terminal.app is not indicated, but likely hardcoded (not using the terminal description). Butscreen
andtmux
do not know how the escape sequences come in, but know thatdim
is not mentioned in the terminal description, hence not supported.You can update your terminfo database to add the
dim
feature to these terminal descriptions, using theinfocmp
andtic
utilities:use
infocmp
to get the existing terminal descriptions forxterm-256color
andscreen-256color
. This shows just the first; you would of course repeat the process for the second description:infocmp -1x xterm-256color > foo
edit the text file created by
infocmp
, adding this lineand replacing the line with
sgr=
with this line:use
tic
to replace the terminal description:sudo tic -x foo
Note: The point of the question was asking why this happens; Nicholas Marriott provided the information for how to work around the problem.