true color in tmux?

If none of the more specific forums is the right place to ask

true color in tmux?

Postby morgon » 2020-11-15 15:09

Hi,

I am using tmux 3.1c-1 in Debian testing and for some reason I cannot get true colors to work.

Both with kitty and with st, the terminal itself shows true colors (I have a script to output a colored line where you can see if you have true colors or not) but in both terminals as soon as I run tmux the true color support is gone.

I assume this is just a matter of proper configuration, but just to avoid wasting time:

Is the tmux-version in the debian repos capable of true colors at all?

Is anyone using a terminal+tmux combination with true colors successfully?

Many thanks!


EDIT:
Figured it out. "set -ga terminal-overrides ",*256col*:Tc" in tmux.conf did the trick.
morgon
 
Posts: 174
Joined: 2010-08-28 03:04

Re: true color in tmux?

Postby RU55EL » 2020-11-15 15:29

morgon wrote:EDIT:
Figured it out. "set -ga terminal-overrides ",*256col*:Tc" in tmux.conf did the trick.


That gave you true color (24 bits per pixel, 16.7 million colors) in tmux?
User avatar
RU55EL
 
Posts: 499
Joined: 2014-04-07 03:42
Location: /home/russel

Re: true color in tmux?

Postby morgon » 2020-11-15 17:15

I set TERM=tmux-265color in my bashrc and also have "set -g default-terminal "tmux-256color"" in my tmux.conf (that may be redunant, but I am currently not in the mood to experiment further).

That (together with the above) gives me true-colors in tmux when run in a terminal that supports it. Works for me in st and kitty.
morgon
 
Posts: 174
Joined: 2010-08-28 03:04

Re: true color in tmux?

Postby Head_on_a_Stick » 2020-11-15 17:17

morgon wrote:I set TERM=tmux-265color in my bashrc

Never set TERM manually, it can cause strange problems.

And for the record: https://gist.github.com/XVilka/8346728
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12795
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: true color in tmux?

Postby morgon » 2020-11-15 18:12

Is that so?

How do you set TERM then?
morgon
 
Posts: 174
Joined: 2010-08-28 03:04

Re: true color in tmux?

Postby Head_on_a_Stick » 2020-11-15 18:15

You don't. The terminal (or application) should set the appropriate TERM itself so that the correct terminfo file is referenced.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12795
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: true color in tmux?

Postby morgon » 2020-11-15 19:02

Do you really understand all the intricacies involved here (because I definitely don't)?

Just one example:

Not setting TERM means xterm will set TERM to "xterm".

But what if you want "xterm-256color"?

Then you have to set that manually...

I've run into much more strange problems NOT setting TERM manually, but maybe you are right...
morgon
 
Posts: 174
Joined: 2010-08-28 03:04

Re: true color in tmux?

Postby Head_on_a_Stick » 2020-11-15 19:22

morgon wrote:Do you really understand all the intricacies involved here (because I definitely don't)?

No, not really. My advice to avoid setting TERM manually is based on *many* problem threads over at the Arch forums caused by doing just that.

morgon wrote:But what if you want "xterm-256color"?

Why would you want that? I see 256 colour support in xterm even if TERM just specifies "xterm" (using the 'colortest-256' command from the colortest package).
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12795
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: true color in tmux?

Postby morgon » 2020-11-15 19:32

Funny...

I can see true-color support in xterm even when TERM is just "xterm" - and I did not expect that.

So why is there a "xterm-256color" entry at all?

But when you then start tmux TERM (in my config at least) is set to "tmux-256color" (not too surprising I guess) - but true color support is gone...

As I said I don't really understand all of this.

This is all legacy crap - if it works fine (I've got a setup that gives me what I want), and if it doesn't then it's time to experiment with TERM...

That's my gist at least...
morgon
 
Posts: 174
Joined: 2010-08-28 03:04

Re: true color in tmux?

Postby Head_on_a_Stick » 2020-11-15 19:48

Hmm, this works for me with xterm if "set -ga terminal-overrides ",*256col*:Tc" is in ~/.tmux.conf:
Code: Select all
TERM=xterm-256color tmux

But TERM in tmux is set to "screen" afterwards ¯\_(ツ)_/¯
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12795
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: true color in tmux?

Postby morgon » 2020-11-15 20:01

It depends on your tmux-config...

With the mentioned terminal-override in tmux.conf I get the behavour that when I start tmux in st, xterm or kitty I still get true colors ONLY IF TERM has been set manually to something ending in "-265color".

If I do not set TERM in bashrc I get the behaviour that true-colors work in st, xterm and kitty but is lost when you start tmux.

Now I do not run a terminal without tmux and so I see real benefit in setting TERM manually...

There may however be ways to get <some-terminal>+tmux with true colors without setting TERM manually, however I can't really be bothered to explore that any further as my setup gives me what I want.

Nevertheless I would be interested in the general question on whether or not you should set TERM manually - however I currently cannot see a way to avoid it...
morgon
 
Posts: 174
Joined: 2010-08-28 03:04


Return to General Questions

Who is online

Users browsing this forum: 4D696B65, MagicPoulp and 25 guests

fashionable