Skip to content

Add support for truecolor in kitty#137

Merged
sindresorhus merged 1 commit intochalk:mainfrom
AprilArcus:kitty
Dec 7, 2022
Merged

Add support for truecolor in kitty#137
sindresorhus merged 1 commit intochalk:mainfrom
AprilArcus:kitty

Conversation

@AprilArcus
Copy link
Copy Markdown
Contributor

No description provided.

@sindresorhus
Copy link
Copy Markdown
Member

Can you link to some docs about this if possible?

@sindresorhus
Copy link
Copy Markdown
Member

And you are sure it does not set any more common environment variable for this? For example COLORTERM.

@sindresorhus sindresorhus changed the title support truecolor in kitty Add support for truecolor in kitty Aug 29, 2022
@Qix-
Copy link
Copy Markdown
Contributor

Qix- commented Aug 29, 2022

cc @kovidgoyal 👋🏻 Does Kitty term indicate truecolor support using any of the already-supported variables? Or does it really define its own terminfo database entry as indicated by the PR?

@kovidgoyal
Copy link
Copy Markdown

What already supported variables? It sets COLORTERM=truecolor. And has setrgbf and
setrgbb in its terminfo. And setaf and setab.

@Qix-
Copy link
Copy Markdown
Contributor

Qix- commented Aug 29, 2022

We don't check the terminfo database here, just environment variables. Good to know, thank you!!!

@AprilArcus can you verify that COLORTERM is indeed set to truecolor and show us a reproduction that this is being ignored?

@AprilArcus
Copy link
Copy Markdown
Contributor Author

AprilArcus commented Aug 29, 2022

COLORTERM is set to truecolor on localhost, but that environment variable does not survive when SSHing to a remote host. TERM does, however:

gnosis% echo $TERM $COLORTERM
xterm-kitty truecolor
gnosis% ssh sophos
Last login: Mon Aug 29 14:02:58 2022 from 172.253.30.65
ril@sophos ~ % echo $TERM $COLORTERM
xterm-kitty

(gnosis is my localhost (macOS 12.5.1, zsh 5.8.1) and sophos is my remote (Linux 5.17.11, zsh 5.9))

@Qix-
Copy link
Copy Markdown
Contributor

Qix- commented Aug 29, 2022

Fair enough. To work around this, you could also do ssh -o SendEnv=COLORTERM, or set it up in your ssh_config.

@AprilArcus
Copy link
Copy Markdown
Contributor Author

I don't control /etc/ssh/sshd_config on the remote end

@Qix-
Copy link
Copy Markdown
Contributor

Qix- commented Aug 29, 2022

That answer is referring to your local ~/.ssh/config file.

God I hate SSH for this. Yeah @sindresorhus this is a rather annoying limitation of SSH. I 👍🏻 this PR. Can't believe we're still dealing with this issue in 2022 but here we are.

@AprilArcus
Copy link
Copy Markdown
Contributor Author

Then on the server, make sure to allow client to pass certain environment variables in your /etc/ssh/sshd_config config file:

AcceptEnv LANG LC_* FOO BAR*

@kovidgoyal
Copy link
Copy Markdown

kovidgoyal commented Aug 29, 2022

You shouldn't rely on env vars for detection. Both sudo and ssh dont pass them through. I would recommend you turn on truecolor by default and only turn it off with a blacklist for the few terminals that dont support it based on TERM. In 2022 most terminals support it.

@AprilArcus If you use the ssh kitten in kitty, it will pass COLORTERM through ssh magically even without needing to modify sshd_config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants