conhost initializes campell color scheme in ANSI/VT order instead of conhost order #1638

Closed
opened 2026-01-30 22:32:40 +00:00 by claunia · 3 comments
Owner

Originally created by @zadjii-msft on GitHub (Jun 12, 2019).

From MSFT:21086112

do a vtpipeterm without the headless. The colors are in the wrong order.

_InitializeCampbellScheme does it in the linux order, not the windows order. There needs to be an initializeWindows and initializeTerminal version of those functions.
People without settings will get the totally wrong colors, because we'll initialize the table to the wrong values

image

Originally created by @zadjii-msft on GitHub (Jun 12, 2019). From MSFT:21086112 do a vtpipeterm without the headless. The colors are in the wrong order. _InitializeCampbellScheme does it in the linux order, not the windows order. There needs to be an initializeWindows and initializeTerminal version of those functions. **People without settings will get the totally wrong colors, because we'll initialize the table to the wrong values** ![image](https://user-images.githubusercontent.com/18356694/59379675-d85bb400-8d1c-11e9-90e5-dcaec1275901.png)
claunia added the Product-ConhostResolution-Fix-CommittedArea-SettingsIssue-Bug labels 2026-01-30 22:32:40 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 12, 2019):

I still don't 100% understand why this impacts which color indices get sent over the wire o_O

@DHowett-MSFT commented on GitHub (Jun 12, 2019): I still don't 100% understand why this impacts which color indices get sent over the wire o_O
Author
Owner

@zadjii-msft commented on GitHub (Jun 12, 2019):

Oh it doesn't, I'm just initializing the order of the colortable incorrectly in conhost.

At some point during a PR, someone was like "hey lets make a helper to set the color table to the campbell scheme, since we're using it in both conhost and the terminal" and I was like, "this is a great idea", hence _InitializeCampbellScheme.

Unfortunately, this is a bad idea, because the colors are in BGR order in conhost, and RGB order in terminal. So for conhosts that are spawned with no settings (e.g. delete the HKCU\Console entirely, then Win+R cmd.exe), the console will appear the wrong colors.

This doesn't affect things that are attached via conpty, since conpty only says "I want index 1" not "I want 0xff00000"

@zadjii-msft commented on GitHub (Jun 12, 2019): Oh it doesn't, I'm just initializing the order of the colortable incorrectly in conhost. At some point during a PR, someone was like "hey lets make a helper to set the color table to the campbell scheme, since we're using it in both conhost and the terminal" and I was like, "this is a great idea", hence `_InitializeCampbellScheme`. Unfortunately, this is a _bad_ idea, because the colors are in BGR order in conhost, and RGB order in terminal. So for conhosts that are spawned with _no_ settings (e.g. delete the `HKCU\Console` entirely, then Win+R `cmd.exe`), the console will appear the wrong colors. This doesn't affect things that are attached via conpty, since conpty only says "I want index 1" not "I want 0xff00000"
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 12, 2019):

Whoa, okay, that makes sense.

@DHowett-MSFT commented on GitHub (Jun 12, 2019): Whoa, okay, that makes sense.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1638