Tmux – Tmux true color is not working properly

Perhaps you overlooked this in setting up (one can see that you overlooked Tc):

commit 427b8204268af5548d09b830e101c59daa095df9
Author: nicm <nicm>
Date:   Fri Jan 29 11:13:56 2016 +0000

    Support for RGB colour, using the extended cell mechanism to avoid
    wasting unnecessary space. The 'Tc' flag must be set in the external
    TERM entry (using terminal-overrides or a custom terminfo entry), if not
    tmux will map to the closest of the 256 or 16 colour palettes.

    Mostly from Suraj N Kurapati, based on a diff originally by someone else.

in tmux.conf:

# Enable RGB colour if running in xterm(1)
set-option -sa terminal-overrides ",xterm*:Tc"

in the manpage:

TERMINFO EXTENSIONS
     tmux understands some unofficial extensions to terminfo(5):
...
     Tc      Indicate that the terminal supports the ‘direct colour’ RGB
             escape sequence (for example, \e[38;2;255;255;255m).

             If supported, this is used for the OSC initialize colour escape 
             sequence (which may be enabled by adding the ‘initc’ and ‘ccc’  
             capabilities to the tmux terminfo(5) entry).

Regarding -s versus -g, the manual page says:

set-option [-agoqsuw] [-t target-session | target-window] option value
(alias: set)
Set a window option with -w (equivalent to the
set-window-option command), a server option with -s, otherwise
a session option. If -g is given, the global session or window
option is set. The -u flag unsets an option, so a session
inherits the option from the global options (or with -g,
restores a global option to the default).

The -o flag prevents setting an option that is already set and
the -q flag suppresses errors about unknown or ambiguous
options.

With -a, and if the option expects a string or a style, value
is appended to the existing setting.

As I understand it,
Using -s means that new connections (created by the server) will get this setting, which is useful in shell initialization, while -g makes its changes too late for the shell initialization.

Further reading:

  • Add TrueColor Support #34
  • Tmux true color support. #622
  • Why only 16 (or 256) colors? (ncurses FAQ)

Leave a Comment