Some colors are swapped in Terminal #835

Closed
opened 2026-01-30 22:05:54 +00:00 by claunia · 8 comments
Owner

Originally created by @melund on GitHub (May 8, 2019).

The red/blue and as yellow/cyan colors are swapped in the new Terminal when using the Campbell color scheme.

The color order is incorrect in "profiles.json". They should have the same order as in campbell.ini

image

Originally created by @melund on GitHub (May 8, 2019). The red/blue and as yellow/cyan colors are swapped in the new Terminal when using the Campbell color scheme. The color order is incorrect in "profiles.json". They should have the same order as in [campbell.ini](https://github.com/microsoft/Terminal/blob/master/src/tools/ColorTool/schemes/campbell.ini) ![image](https://user-images.githubusercontent.com/1038978/57361722-55739680-717d-11e9-966d-fff6b102a33d.png)
claunia added the Area-OutputIssue-BugArea-VTResolution-DuplicateProduct-Terminal labels 2026-01-30 22:05:55 +00:00
Author
Owner

@zadjii-msft commented on GitHub (May 8, 2019):

Ah see, they actually shouldn't.

Windows does colors weird for whatever reason, and does them in BGR order, while the rest of the world does them in RGB order. so, conhost's color table was always in BGR order, and when you were using VT sequences to set colors, you'd always have to translate the indices to their equivalent RGB-ordered indices.

Having the color table in RGB order removes a bunch of this logic, and makes our compatibility with other terminals a bit higher :)

@zadjii-msft commented on GitHub (May 8, 2019): Ah see, they actually shouldn't. Windows does colors weird for whatever reason, and does them in BGR order, while the rest of the world does them in RGB order. so, conhost's color table was always in BGR order, and when you were using VT sequences to set colors, you'd always have to translate the indices to their equivalent RGB-ordered indices. Having the color table in RGB order removes a bunch of this logic, and makes our compatibility with other terminals a bit higher :)
Author
Owner

@melund commented on GitHub (May 9, 2019):

Thanks @zadjii-msft. That makes sense. But it wasn't what was causing my colors to get swapped. Also, it appears to only affect 24 bit ansi colors. So maybe not directly related to the color scheme.

I only see some weird behavior when trying output some particular RGB colors. For example this blue color (0,55,218) which outputs as red.

image

If I just change the color slightly (e.g. [0,55, 219]) it becomes blue again:
image

It only appears to happen if I print the colors which are already in the ColorScheme list and have already been used with the standard 16 color ansi codes. Additionally, it seems it only affects those colors which were swapped in the new ordering of the ColorScheme list.

So maybe some caching is going wrong. Just a guess.

@melund commented on GitHub (May 9, 2019): Thanks @zadjii-msft. That makes sense. But it wasn't what was causing my colors to get swapped. Also, it appears to only affect 24 bit ansi colors. So maybe not directly related to the color scheme. I only see some weird behavior when trying output some particular RGB colors. For example this blue color (0,55,218) which outputs as red. ![image](https://user-images.githubusercontent.com/1038978/57448070-ce93ec00-7258-11e9-9f0a-db9043965752.png) If I just change the color slightly (e.g. [0,55, 219]) it becomes blue again: ![image](https://user-images.githubusercontent.com/1038978/57448202-1a469580-7259-11e9-905b-9486ee6b513e.png) It only appears to happen if I print the colors which are already in the ColorScheme list and have already been used with the standard 16 color ansi codes. Additionally, it seems it only affects those colors which were swapped in the new ordering of the ColorScheme list. So maybe some caching is going wrong. Just a guess.
Author
Owner

@zadjii-msft commented on GitHub (May 9, 2019):

Woah okay, that's insane.

Yea I can dig in to that.

@zadjii-msft commented on GitHub (May 9, 2019): Woah okay, that's insane. Yea I can dig in to that.
Author
Owner

@waf commented on GitHub (May 9, 2019):

I experienced this when I was porting my cmd/powershell theme to the new terminal. Here are expected / actual colors:

Expected Order Actual Order
dark black dark black
dark blue dark red
dark green dark green
dark cyan dark yellow
dark red dark blue
dark magenta dark magenta
dark yellow dark cyan
dark white dark white
bright black bright black
bright blue bright red
bright green bright green
bright cyan bright yellow
bright red bright blue
bright magenta bright magenta
bright yellow bright cyan
bright white bright white
@waf commented on GitHub (May 9, 2019): I experienced this when I was porting my [cmd/powershell theme](https://github.com/dracula/powershell) to the new terminal. Here are expected / actual colors: Expected Order | Actual Order ------------ | ------------- dark black | dark black dark blue | **dark red** dark green | dark green dark cyan | **dark yellow** dark red | **dark blue** dark magenta | dark magenta dark yellow | **dark cyan** dark white | dark white bright black | bright black bright blue | **bright red** bright green | bright green bright cyan | **bright yellow** bright red | **bright blue** bright magenta | bright magenta bright yellow | **bright cyan** bright white | bright white
Author
Owner

@ExE-Boss commented on GitHub (May 15, 2019):

Unfortunately, the current order is correct according to ANSI, while the order this issue wants to use would break ANSI 4bit indexed colour, which goes:

ANSI Colour Colour Code
Dark Black #0C0C0C
Dark Red #C50F1F
Dark Green #13A10E
Dark Yellow #C19C00
Dark Blue #0037DA
Dark Magenta #881798
Dark Cyan #3A96DD
Dark White #CCCCCC
Bright Black #767676
Bright Red #E74856
Bright Green #16C60C
Bright Yellow #F9F1A5
Bright Blue #3878FF
Bright Magenta #B4009E
Bright Cyan #61D6D6
Bright White #F2F2F2
@ExE-Boss commented on GitHub (May 15, 2019): Unfortunately, the current order is correct according to ANSI, while the order this issue wants to use would break ANSI [4bit indexed colour](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit), which goes: | ANSI Colour | Colour Code | | ----------- | ----------- | | Dark Black | `#0C0C0C` | | Dark Red | `#C50F1F` | | Dark Green | `#13A10E` | | Dark Yellow | `#C19C00` | | Dark Blue | `#0037DA` | | Dark Magenta | `#881798` | | Dark Cyan | `#3A96DD` | | Dark White | `#CCCCCC` | | Bright Black | `#767676` | | Bright Red | `#E74856` | | Bright Green | `#16C60C` | | Bright Yellow | `#F9F1A5` | | Bright Blue | `#3878FF` | | Bright Magenta | `#B4009E` | | Bright Cyan | `#61D6D6` | | Bright White | `#F2F2F2` |
Author
Owner

@melund commented on GitHub (May 15, 2019):

Yes. The order was not the problem. But some colors are rendered incorrectly when using the explicit 24 bit ansi escapes. It seems it only happens when when trying to render the colors from 4 bit list, and then only for colors which swapped place from the old ordering to new correct one. Seems a bit peculiar.

@melund commented on GitHub (May 15, 2019): Yes. The order was not the problem. But some colors are rendered incorrectly when using the explicit 24 bit ansi escapes. It seems it only happens when when trying to render the colors from 4 bit list, and then only for colors which swapped place from the old ordering to new correct one. Seems a bit peculiar.
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 28, 2020):

But some colors are rendered incorrectly when using the explicit 24 bit ansi escapes.

I never put 2&2 together here, but I think this is /dup #2661.

@DHowett-MSFT commented on GitHub (Jan 28, 2020): > But some colors are rendered incorrectly when using the explicit 24 bit ansi escapes. I never put 2&2 together here, but I think this is /dup #2661.
Author
Owner

@ghost commented on GitHub (Jan 28, 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 (Jan 28, 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!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#835