Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

true color in tmux?

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
morgon
Posts: 189
Joined: 2010-08-28 03:04

true color in tmux?

#1 Post by morgon »

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.

User avatar
RU55EL
Posts: 546
Joined: 2014-04-07 03:42
Location: /home/russel

Re: true color in tmux?

#2 Post by RU55EL »

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?

morgon
Posts: 189
Joined: 2010-08-28 03:04

Re: true color in tmux?

#3 Post by morgon »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: true color in tmux?

#4 Post by Head_on_a_Stick »

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
deadbang

morgon
Posts: 189
Joined: 2010-08-28 03:04

Re: true color in tmux?

#5 Post by morgon »

Is that so?

How do you set TERM then?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: true color in tmux?

#6 Post by Head_on_a_Stick »

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

morgon
Posts: 189
Joined: 2010-08-28 03:04

Re: true color in tmux?

#7 Post by morgon »

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...

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: true color in tmux?

#8 Post by Head_on_a_Stick »

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).
deadbang

morgon
Posts: 189
Joined: 2010-08-28 03:04

Re: true color in tmux?

#9 Post by morgon »

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...

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: true color in tmux?

#10 Post by Head_on_a_Stick »

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 ¯\_(ツ)_/¯
deadbang

morgon
Posts: 189
Joined: 2010-08-28 03:04

Re: true color in tmux?

#11 Post by morgon »

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...

Lincoln
Posts: 1
Joined: 2020-12-07 11:06

Re: true color in tmux?

#12 Post by Lincoln »

You're probably missing the right config in tmux to enable the truecolor setting. It'll look something like:

set -g default-terminal 'screen-256color'
set -ga terminal-overrides ',screen-256color:Tc'
Also worth mentioning, I think this requires at least tmux 2.2, and won't work with earlier versions








myfordbenefits

Post Reply