Propagate palette changes on the legacy console through ConPTY w/ OSC 4 #4167

Open
opened 2026-01-30 23:39:47 +00:00 by claunia · 8 comments
Owner

Originally created by @manups4e on GitHub (Sep 30, 2019).

Environment

Windows build number: Microsoft Windows [Versione 10.0.18362.356]
Windows Terminal version (if applicable): 0.5.2681.0

Any other software?
FiveM CitizenFX collective GTA Modification server Build

Steps to reproduce

using the library Colorful.Console in a c# project the output color in console is different from the color requested and in the original CMD color is correctly interpreted

Expected behavior

i expect colors to be shown correctly

Actual behavior

Colors are not correctly shown

image

image

Originally created by @manups4e on GitHub (Sep 30, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```Windows 10 latest build Windows build number: Microsoft Windows [Versione 10.0.18362.356] Windows Terminal version (if applicable): 0.5.2681.0 Any other software? FiveM CitizenFX collective GTA Modification server Build ``` # Steps to reproduce using the library Colorful.Console in a c# project the output color in console is different from the color requested and in the original CMD color is correctly interpreted # Expected behavior i expect colors to be shown correctly # Actual behavior Colors are not correctly shown ![image](https://user-images.githubusercontent.com/4005518/65869243-5ac6bd00-e37a-11e9-937c-a7c0b6b3d1b4.png) ![image](https://user-images.githubusercontent.com/4005518/65869414-b3965580-e37a-11e9-8f89-cfb0c62bd299.png)
claunia added the Help WantedIssue-TaskArea-VTProduct-Conpty labels 2026-01-30 23:39:48 +00:00
Author
Owner

@skyline75489 commented on GitHub (Sep 30, 2019):

It seems a color scheme difference to me, instead of a bug.

@skyline75489 commented on GitHub (Sep 30, 2019): It seems a color scheme difference to me, instead of a bug.
Author
Owner

@manups4e commented on GitHub (Sep 30, 2019):

i see

@manups4e commented on GitHub (Sep 30, 2019): i see
Author
Owner

@zadjii-msft commented on GitHub (Sep 30, 2019):

@manups4e could you share your profiles.json?

Part of it looks like it might be a different colorscheme, but Colorful.Console looks like it's setting the color table to achieve these colors:

Colorful.Console can only write to the console in 16 different colors (including the black that's used as the console's background, by default!) in a single console session. This is a limitation of the Windows console itself (ref: MSDN), and it's one that I wasn't able to work my way around. If you know of a workaround, let me know!

So what's probably happening is we're failing to render color table changes through conpty.

@zadjii-msft commented on GitHub (Sep 30, 2019): @manups4e could you share your `profiles.json`? Part of it looks like it might be a different colorscheme, but [Colorful.Console](http://colorfulconsole.com/) looks like it's _setting the color table_ to achieve these colors: > Colorful.Console can only write to the console in 16 different colors (including the black that's used as the console's background, by default!) in a single console session. This is a limitation of the Windows console itself (ref: MSDN), and it's one that I wasn't able to work my way around. If you know of a workaround, let me know! So what's probably happening is we're failing to render color table changes through conpty.
Author
Owner

@manups4e commented on GitHub (Sep 30, 2019):

here :) well.. right now i'm using it on normal cmd and it works
profiles.zip

@manups4e commented on GitHub (Sep 30, 2019): here :) well.. right now i'm using it on normal cmd and it works [profiles.zip](https://github.com/microsoft/terminal/files/3671617/profiles.zip)
Author
Owner

@zadjii-msft commented on GitHub (Sep 30, 2019):

This might also be related to the upstream tomakita/Colorful.Console#24

@zadjii-msft commented on GitHub (Sep 30, 2019): This might also be related to the upstream tomakita/Colorful.Console#24
Author
Owner

@manups4e commented on GitHub (Oct 1, 2019):

well.. preinstalled cmd works as intended

@manups4e commented on GitHub (Oct 1, 2019): well.. preinstalled cmd works as intended
Author
Owner

@j4james commented on GitHub (Jun 28, 2020):

FYI, I can confirm that the problem is indeed the console color table changes not being passed on. I hacked together a POC that checked for conpty mode in the ApiRoutines::SetConsoleScreenBufferInfoExImpl method, and then forwarded any color table changes as OSC 4 VT sequences, and that seemed to get all the colors rendering correctly. There's a limit to how many colors you can have at the same time, but that's to be expected.

@j4james commented on GitHub (Jun 28, 2020): FYI, I can confirm that the problem is indeed the console color table changes not being passed on. I hacked together a POC that checked for conpty mode in the `ApiRoutines::SetConsoleScreenBufferInfoExImpl` method, and then forwarded any color table changes as OSC 4 VT sequences, and that seemed to get all the colors rendering correctly. There's a limit to how many colors you can have at the same time, but that's to be expected.
Author
Owner

@DHowett commented on GitHub (Aug 13, 2020):

I'm going to transform this into a task and give it a better title: "Propagate palette changes on the legacy console through ConPTY w/ OSC 4"

@DHowett commented on GitHub (Aug 13, 2020): I'm going to transform this into a task and give it a better title: "Propagate palette changes on the legacy console through ConPTY w/ OSC 4"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4167