ITU/ODA colors with a zero color space don't work #23795

Open
opened 2026-01-31 08:52:44 +00:00 by claunia · 0 comments
Owner

Originally created by @j4james on GitHub (Nov 10, 2025).

Windows Terminal version

1.24.2812.0

Windows build number

10.0.19045.5371

Other Software

No response

Steps to reproduce

Open a WSL shell and execute the following statements:

printf "\e[38:2::255:0:0mRED\e[m\n"
printf "\e[38:2:0:255:0:0mRED\e[m\n"

These are ITU T.416 RGB color sequences that set the foreground to bright red. The first case is using a default color space ID, and the second case has the color space ID set to zero, which should be the same thing.

Expected Behavior

In both cases I'd expect the text to be rendered with a red foreground color.

Actual Behavior

Only the first case is red - the second case is rendered with the default attributes.

Looking at the code, it seems this was somewhat by design. We're trying to detect cases where the sequence is incorrectly formatted, with the red component in the position of the color space ID. And the assumption is that it's better to ignore those sequences than produce a completely wrong color.

47018442cd/src/terminal/adapter/adaptDispatchGraphics.cpp (L128-L131)

But if we're going to take that approach, I think the test probably needs to be stricter, because this is clearly not an incorrectly formatted colour - it has all the required components. And most other terminals that support ITU colors do render this case correctly (although we're not the only one that fails).

So maybe we should only be rejecting sequences that have a non-default color space, but also have a missing blue component?

Originally created by @j4james on GitHub (Nov 10, 2025). ### Windows Terminal version 1.24.2812.0 ### Windows build number 10.0.19045.5371 ### Other Software _No response_ ### Steps to reproduce Open a WSL shell and execute the following statements: ```bash printf "\e[38:2::255:0:0mRED\e[m\n" printf "\e[38:2:0:255:0:0mRED\e[m\n" ``` These are ITU T.416 RGB color sequences that set the foreground to bright red. The first case is using a default color space ID, and the second case has the color space ID set to zero, which should be the same thing. ### Expected Behavior In both cases I'd expect the text to be rendered with a red foreground color. ### Actual Behavior Only the first case is red - the second case is rendered with the default attributes. Looking at the code, it seems this was somewhat by design. We're trying to detect cases where the sequence is incorrectly formatted, with the red component in the position of the color space ID. And the assumption is that it's better to ignore those sequences than produce a completely wrong color. https://github.com/microsoft/terminal/blob/47018442cdb0fac323f9d68ff8e3156909882b9b/src/terminal/adapter/adaptDispatchGraphics.cpp#L128-L131 But if we're going to take that approach, I think the test probably needs to be stricter, because this is clearly not an incorrectly formatted colour - it _has_ all the required components. And most other terminals that support ITU colors _do_ render this case correctly (although we're not the only one that fails). So maybe we should only be rejecting sequences that have a non-default color space, but _also_ have a missing blue component?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23795