24-bit background color disappears if no text is set #11314

Closed
opened 2026-01-31 02:44:14 +00:00 by claunia · 5 comments
Owner

Originally created by @scrouthtv on GitHub (Nov 8, 2020).

Environment

Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.19041.0 Microsoft Windows NT 10.0.19041.0
Windows Terminal version (if applicable): Windows Terminal Preview 20.10.2020 Version 1.4.2652.0

Any other software?
optionally wsl2 but not related

Steps to reproduce

If VT100 escape sequence parsing is enabled (as described in https://docs.microsoft.com/en-us/windows/console/setconsolemode under ENABLE_VIRTUAL_TERMINAL_PROCESSING), background colors can be set in the powershell using an escape sequence of the form \033[38;2;r;g;bm%s where r, g, b are the 8bit components of the rgb color and %s is the string to draw.
If it helps, here is some Go code that will use those escape sequences to draw (along with some other unimportant things) an rgb-colored box:
image
The very same thing can also be achieved using a bash (sh) script that leverages those VT100 escape sequences to draw a smiliar cube, you can find this script here

  1. Either download one of my examples or print some rgb colored text into the new Terminal. **It is important that the text drawn is empty (e. g. a blankspace " " and not actually symbols).
  2. Resize the terminal. Normally the colors should stay there:
    xresize
    They do in this example. There is still some weird stuff happening because the reset sequence at the end goes missing some time in between.
    However, if only blank spaces and no symbols are printed (the background color has to be set), this color disappears on resize:
    blankresize
    Notice how the colors disappear when I resize the terminal.

Expected behavior

The background color should still be set if I resize the terminal, no matter if something was printed before or not.

Actual behavior

The background color is cleared if no actual text is printed and I resize the terminal.

This is just a minor inconvenience I noticed. I don't think many people are out there resizing their terminal with a giant rgb cube in the middle of it (I don't often do). It's not that important for me to be fixed, I just wanted to let you know.
Thanks nevertheless for the great work and have a nice day!

Originally created by @scrouthtv on GitHub (Nov 8, 2020). # Environment ```none Platform ServicePack Version VersionString -------- ----------- ------- ------------- Win32NT 10.0.19041.0 Microsoft Windows NT 10.0.19041.0 Windows Terminal version (if applicable): Windows Terminal Preview 20.10.2020 Version 1.4.2652.0 Any other software? optionally wsl2 but not related ``` # Steps to reproduce If VT100 escape sequence parsing is enabled (as described in https://docs.microsoft.com/en-us/windows/console/setconsolemode under `ENABLE_VIRTUAL_TERMINAL_PROCESSING`), background colors can be set in the powershell using an escape sequence of the form `\033[38;2;r;g;bm%s` where r, g, b are the 8bit components of the rgb color and `%s` is the string to draw. If it helps, here is some Go code that will use those escape sequences to draw (along with some other unimportant things) an rgb-colored box: ![image](https://user-images.githubusercontent.com/23227405/98463145-8b9e3600-21b9-11eb-9b1c-52773f01d891.png) The very same thing can also be achieved using a bash (sh) script that leverages those VT100 escape sequences to draw a smiliar cube, you can find this script [here](https://raw.githubusercontent.com/scrouthtv/bash-colorpicker/main/rgbtest.sh) 1. Either download one of my examples or print some rgb colored text into the new Terminal. **It is important that the text drawn is empty (e. g. a blankspace " " and not actually symbols). 2. Resize the terminal. Normally the colors should stay there: ![xresize](https://user-images.githubusercontent.com/23227405/98463229-1848f400-21ba-11eb-9869-68140c8c0784.gif) They do in this example. There is still some weird stuff happening because the reset sequence at the end goes missing some time in between. However, if only blank spaces and no symbols are printed (the background color has to be set), this color disappears on resize: ![blankresize](https://user-images.githubusercontent.com/23227405/98463269-5b0acc00-21ba-11eb-9a3e-8c240ac643cf.gif) Notice how the colors disappear when I resize the terminal. # Expected behavior The background color should still be set if I resize the terminal, no matter if something was printed before or not. # Actual behavior The background color is cleared if no actual text is printed and I resize the terminal. This is just a minor inconvenience I noticed. I don't think many people are out there resizing their terminal with a giant rgb cube in the middle of it (I don't often do). It's not that important for me to be fixed, I just wanted to let you know. Thanks nevertheless for the great work and have a nice day!
claunia added the Resolution-Duplicate label 2026-01-31 02:44:14 +00:00
Author
Owner

@scrouthtv commented on GitHub (Nov 8, 2020):

Also, I just noticed, that in the first example, I rescale the window horizontally, and in the second example, I rescale the window vertically. It does not matter in which direction I resize the window, when there is no text, the background color vanishes:
blankresizeh

@scrouthtv commented on GitHub (Nov 8, 2020): Also, I just noticed, that in the first example, I rescale the window horizontally, and in the second example, I rescale the window vertically. **It does not matter in which direction I resize the window**, when there is no text, the background color vanishes: ![blankresizeh](https://user-images.githubusercontent.com/23227405/98463340-dbc9c800-21ba-11eb-80ca-c9e33c5cc5c1.gif)
Author
Owner

@zadjii-msft commented on GitHub (Nov 8, 2020):

Congrats, you've found one of the oldest issues on this repo 😄 This is actually already being tracked by another issue on our repo - please refer to #32 for more discussion.

/dup #32

@zadjii-msft commented on GitHub (Nov 8, 2020): Congrats, you've found one of the _oldest issues on this repo_ 😄 This is actually already being tracked by another issue on our repo - please refer to #32 for more discussion. /dup #32
Author
Owner

@ghost commented on GitHub (Nov 8, 2020):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Nov 8, 2020): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@scrouthtv commented on GitHub (Nov 11, 2020):

Oh sorry, I didn't look that far into duplicates :')

@scrouthtv commented on GitHub (Nov 11, 2020): Oh sorry, I didn't look that far into duplicates :')
Author
Owner

@jdebp commented on GitHub (Nov 15, 2020):

For the benefit of posterity: Calling these things "VT100 escape sequences" is a bad habit to get into. They are control sequences (begun with an escape sequence) and the VT100 was a monochrome terminal and didn't understand anything to do with colours.

@jdebp commented on GitHub (Nov 15, 2020): For the benefit of posterity: Calling these things "VT100 escape sequences" is a bad habit to get into. They are _control_ sequences (_begun_ with an escape sequence) and the VT100 was a monochrome terminal and didn't understand anything to do with colours.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11314