No bright colors under screen/irssi in SSH session #10450

Closed
opened 2026-01-31 02:21:54 +00:00 by claunia · 6 comments
Owner

Originally created by @sec on GitHub (Sep 2, 2020).

Environment

Windows build number: Microsoft Windows [Version 10.0.19041.450]
Windows Terminal version 1.2.2381.0 and Preview 1.3.2382.0

Steps to reproduce

  1. SSH to remote machine (FreeBSD used here)
  2. run 'screen irssi'
  3. under irssi: /exec colors.sh

colors.sh

Expected behavior

Bright colors (bottom part of the image)

Actual behavior

Only "normal" colors are visible (top part of the image), like the bright/bold are replaced by normal ones:
image

Bottom part is when irssi is launched without "screen".
Colors are working fine when using Windows Terminal v1.1.2233.0

Originally created by @sec on GitHub (Sep 2, 2020). # Environment ```none Windows build number: Microsoft Windows [Version 10.0.19041.450] Windows Terminal version 1.2.2381.0 and Preview 1.3.2382.0 ``` # Steps to reproduce 1. SSH to remote machine (FreeBSD used here) 2. run 'screen irssi' 3. under irssi: /exec colors.sh [colors.sh](https://gist.github.com/sec/e13173521d9742302f7db83bb3594c84) # Expected behavior Bright colors (bottom part of the image) # Actual behavior Only "normal" colors are visible (top part of the image), like the bright/bold are replaced by normal ones: ![image](https://user-images.githubusercontent.com/288111/91970058-6273ac00-ed17-11ea-9606-6a83c7bc89ad.png) Bottom part is when irssi is launched without "screen". Colors are working fine when using Windows Terminal v1.1.2233.0
Author
Owner

@DHowett commented on GitHub (Sep 2, 2020):

screen is another terminal emulator, and as such it has the chance to manipulate all colors that come through it.

Can you share the output of echo $TERM; infocmp inside and outside screen?

@DHowett commented on GitHub (Sep 2, 2020): _screen is another terminal emulator_, and as such it has the chance to manipulate all colors that come through it. Can you share the output of `echo $TERM; infocmp` inside and outside screen?
Author
Owner

@sec commented on GitHub (Sep 2, 2020):

screen is another terminal emulator, and as such it has the chance to manipulate all colors that come through it.

Can you share the output of echo $TERM; infocmp inside and outside screen?

Yes I know that, but weird it started to behave that way after upgrade to 1.2.
TERM inside screen is screen
TERM outside screen is xterm-256color

I don't have infocmp as I'm on 11.4 (can provide more info when I'll upgrade the box to 12).

I tried setting TERM to xterm-256color and even screen-256color inside screen, then launching irssi - still no bold colors.
Weird this is, that under screen, colors are ok, it's just that launching irssi is causing this weird behavior.

Just found that if I set TERM to xterm and then screen -r - colors are fine. Looks like xterm-256color is broken, at least for me :)
Any way I can set TERM to something else under Windows Terminal ?

@sec commented on GitHub (Sep 2, 2020): > _screen is another terminal emulator_, and as such it has the chance to manipulate all colors that come through it. > > Can you share the output of `echo $TERM; infocmp` inside and outside screen? Yes I know that, but weird it started to behave that way after upgrade to 1.2. TERM inside screen is `screen` TERM outside screen is `xterm-256color` I don't have `infocmp` as I'm on 11.4 (can provide more info when I'll upgrade the box to 12). I tried setting TERM to `xterm-256color` and even `screen-256color` inside screen, then launching irssi - still no bold colors. Weird this is, that under screen, colors are ok, it's just that launching irssi is causing this weird behavior. Just found that if I set TERM to xterm and then `screen -r` - colors are fine. Looks like `xterm-256color` is broken, at least for me :) Any way I can set TERM to something else under Windows Terminal ?
Author
Owner

@DHowett commented on GitHub (Sep 2, 2020):

I believe I've seen this before, actually. When screen believes that the outer terminal is true-color-compatible, but cannot handle certain other sequences, it will translate the colors on the inside. In 1.2 we actually improved color rendition... which tends to expose applications doing unexpected things.

Can you run script, and then reproduce the screen+irssi color issue? It should produce a document named typescript that contains the raw output from screen that we're receiving in the Terminal. I'd be interested in seeing that document.

@DHowett commented on GitHub (Sep 2, 2020): I believe I've seen this before, actually. When `screen` believes that the outer terminal is true-color-compatible, but cannot handle certain other sequences, it will _translate_ the colors on the inside. In 1.2 we actually improved color rendition... which tends to expose applications doing unexpected things. Can you run `script`, and then reproduce the screen+irssi color issue? It should produce a document named `typescript` that contains the raw output from screen that we're receiving in the Terminal. I'd be interested in seeing that document.
Author
Owner

@sec commented on GitHub (Sep 2, 2020):

Issue with colors
No issue with colors, launched irssi outside screen

Happy reading :) let me know if I can help more

@sec commented on GitHub (Sep 2, 2020): [Issue with colors](https://gist.github.com/sec/7b8b18251e2e3fac1a203a9ca3a33f53) [No issue with colors, launched irssi outside screen](https://gist.github.com/sec/7b8b18251e2e3fac1a203a9ca3a33f53) Happy reading :) let me know if I can help more
Author
Owner

@DHowett commented on GitHub (Sep 2, 2020):

Thanks! So, bad news. (Those two pastes are the same thing, but:)

The inbox termcap for screen-256color suggests that all colors must be rendered using ITU extended sequences. This means that irssi is translating \e[91m to \e[38;5;1m\e[1m. We (and many other terminal emulators) decided that brighten/intensity should not apply to the extended ITU colors (#5384)... so this translation is "incorrect" from the perspective of modern terminal emulation.

The updated terminfo seems to specify that colors should be treated with more care (cf this entry for xterm+256setaf, which is the base type for screen-256color), but perhaps that hasn't reached your ports tree yet.

The resolution to this one is, for now, "by design". Sorry!

@DHowett commented on GitHub (Sep 2, 2020): Thanks! So, bad news. (Those two pastes are the same thing, but:) The inbox termcap for screen-256color suggests that _all colors must be rendered using ITU extended sequences_. This means that irssi is translating `\e[91m` to `\e[38;5;1m\e[1m`. We (and many other terminal emulators) decided that brighten/intensity should not apply to the extended ITU colors (#5384)... so this translation is "incorrect" from the perspective of modern terminal emulation. The updated terminfo seems to specify that colors should be treated with more care (cf [this entry](https://invisible-island.net/ncurses/terminfo.src.html#tic-xterm_256setaf) for `xterm+256setaf`, which is the base type for screen-256color), but perhaps that hasn't reached your ports tree yet. The resolution to this one is, for now, "by design". Sorry!
Author
Owner

@jdebp commented on GitHub (Sep 2, 2020):

These seem to be the parts of irssi to look at. Notice that they are triggered when irssi thinks that it is talking to an 8-color terminal, which of course the termcap database says that the screen terminal type is.

@jdebp commented on GitHub (Sep 2, 2020): * https://github.com/irssi/irssi/blob/a0544571a80196e5b7705f56e6e2cbcdf7b4d80e/src/fe-text/term-terminfo.c#L429 * https://github.com/irssi/irssi/blob/a0544571a80196e5b7705f56e6e2cbcdf7b4d80e/src/fe-text/term-terminfo.c#L405 These seem to be the parts of irssi to look at. Notice that they are triggered when irssi thinks that it is talking to an 8-color terminal, which of course the termcap database says that the `screen` terminal type is.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10450