microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.79k stars 8.33k forks source link

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

Open manups4e opened 5 years ago

manups4e commented 5 years ago

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

skyline75489 commented 5 years ago

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

manups4e commented 5 years ago

i see

zadjii-msft commented 5 years ago

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

manups4e commented 5 years ago

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

zadjii-msft commented 5 years ago

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

manups4e commented 5 years ago

well.. preinstalled cmd works as intended

j4james commented 4 years ago

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.

DHowett commented 4 years ago

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"