Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tmux - Tmux true color is not working properly

Tags:

I'm using tmux for sometime now,

I use vim for coding, and I've noticed some flaws related to the colorschemes ONLY when I'm using vim with tmux.

Both terminal support 256 colors when I run this: tput colors

When I test my terminal to see if support true colors this is the result:

curl -s https://raw.githubusercontent.com/JohnMorales/dotfiles/master/colors/24-bit-color.sh | bash 

the output from the terminal is this: enter image description here

but when I run this within tmux: enter image description here

I've checked the result of echo $TERM but both of them return this:

xterm-256color 

So I'm really confused about what might be the problem here =\

Any idea?

Thanks a lot!

like image 652
SupimpaAllTheWay Avatar asked Jan 21 '17 19:01

SupimpaAllTheWay


People also ask

Does tmux support true color?

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Does kitty support true color?

kitty is a scriptable OpenGL based terminal emulator with TrueColor, ligatures support, protocol extensions for keyboard input and image rendering. It also offers tiling capabilities, like GNU Screen or tmux.

Does tmux support 256 colors?

The Tmux FAQ explicitly advises against setting TERM to anything other than screen or screen-256color or tmux or tmux-256color in your shell init file, so don't do it!

Does Alacritty support true colors?

Alacritty is a simple, GPU-accelerated terminal emulator written in Rust. It supports scrollback, 24-bit colors (w:Color depth#True color (24-bit), copy/paste, clicking on URLs, and custom key bindings.


1 Answers

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)
like image 51
Thomas Dickey Avatar answered Oct 06 '22 21:10

Thomas Dickey