2017-02-19 9:33 GMT+02:00 Kaushal Modi <kaushal.modi@gmail.com>:

I cannot set the 24-bit colors working on xterm directly.

XTerm supports the direct color mode escape sequences, but approximates colors. See https://gist.github.com/XVilka/8346728#parsing-ansi-colour-sequences-but-approximating-them-to-256-palette and https://gist.github.com/XVilka/8346728#now-supporting-truecolour for details.

Note that if you want to use XTerm, then using TERM=xterm-256color with Emacs is enough, because 24-bit colors are approximated anyway.

I did not do a full bootstrap. But it still seems to work in uxterm in tmux configured for 24-bits.
But it doesn't work directly in an xterm terminal.

What debug information can I provide from the direct xterm session or xterm+tmux session?

I haven't used tmux before, but I was able to make Emacs work in direct color mode with following steps:

* Use a terminal that supports 24-bit colors (gnome-terminal).

* Compile tmux from https://github.com/tmux/tmux.git. The version provided with Ubuntu doesn't support Tc-flag.

* Use following terminfo source (add the Tc-flag and use semicolon separators for tmux):

$ cat terminfo-24bit.src

# Use semicolon separators.
xterm-24bits|xterm with 24-bit direct color mode,
        use=xterm-256color,
        Tc,
        setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
        setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,

 * Compile the terminfo source, run tmux, set your TERM to xterm-24bits, check that Tc is supported:

$ tmux info | grep Tc
 199: Tc: (flag) true

* Finally run Emacs under tmux.