Unable to set colors above index 15 with OSC 4, take 2 #5204

Closed
opened 2026-01-31 00:07:28 +00:00 by claunia · 5 comments
Owner

Originally created by @egmontkob on GitHub (Nov 26, 2019).

Environment

Windows build number: 10.0.18362.0
Windows Terminal version (if applicable): 0.7.3291.0

Steps to reproduce

Allegedly already fixed in #313, but doesn't work in v0.7:

echo -ne '\e]4;15;rgb:ab/cd/ef\e\\'
echo -ne '\e]4;16;rgb:ab/cd/ef\e\\'

Expected behavior

Set palette index 15 and 16 to the given color.

Actual behavior

Color index 15 is set to the given value (works for 0..15), index 16 remains unchanged (doesn't work for 16..255).

Originally created by @egmontkob on GitHub (Nov 26, 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 ```none Windows build number: 10.0.18362.0 Windows Terminal version (if applicable): 0.7.3291.0 ``` # Steps to reproduce Allegedly already fixed in #313, but doesn't work in v0.7: echo -ne '\e]4;15;rgb:ab/cd/ef\e\\' echo -ne '\e]4;16;rgb:ab/cd/ef\e\\' # Expected behavior Set palette index 15 and 16 to the given color. # Actual behavior Color index 15 is set to the given value (works for 0..15), index 16 remains unchanged (doesn't work for 16..255).
Author
Owner

@zadjii-msft commented on GitHub (Nov 26, 2019):

My guess is that setting the colors >15 probably works in conhost, but doesn't roundtrip through conpty.

@zadjii-msft commented on GitHub (Nov 26, 2019): My guess is that setting the colors >15 probably works in conhost, but doesn't roundtrip through conpty.
Author
Owner

@j4james commented on GitHub (Nov 30, 2019):

This doesn't really work on conhost either. You can technically set all the colors, and any future use of those colors will be displayed correctly, but your existing output won't update. In fact even the first 16 colors won't update if you've set them using the 256-color index syntax. I think that is what issue #1223 is all about.

Fixing #1223 is a bit of a nightmare, but I put together a hack solution just to see what would happen, and it also partially resolves the issue in the Windows Terminal. Sometimes, though, the colors just don't refresh, and I don't know enough about that side of the code to figure out why.

@j4james commented on GitHub (Nov 30, 2019): This doesn't really work on conhost either. You can technically set all the colors, and any future use of those colors will be displayed correctly, but your existing output won't update. In fact even the first 16 colors won't update if you've set them using the 256-color index syntax. I think that is what issue #1223 is all about. Fixing #1223 is a bit of a nightmare, but I put together a hack solution just to see what would happen, and it also partially resolves the issue in the Windows Terminal. Sometimes, though, the colors just don't refresh, and I don't know enough about that side of the code to figure out why.
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 30, 2019):

I wonder: does fixing #2661 and then triggering a full invalidate on all screenful renderers help #1223? It seems like it may..

@DHowett-MSFT commented on GitHub (Nov 30, 2019): I wonder: does fixing #2661 and then triggering a full invalidate on all screenful renderers help #1223? It seems like it may..
Author
Owner

@j4james commented on GitHub (Nov 30, 2019):

Actually I was going to say fixing #1223 is probably a prerequisite for fixing #2661. If you want to preserve the color index when passing the attributes through conpty, that assumedly requires that the index was already preserved on the conhost side when writing to the output buffer - and that's essentially the fix for #1223.

@j4james commented on GitHub (Nov 30, 2019): Actually I was going to say fixing #1223 is probably a prerequisite for fixing #2661. If you want to preserve the color index when passing the attributes through conpty, that assumedly requires that the index was already preserved on the conhost side when writing to the output buffer - and that's essentially the fix for #1223.
Author
Owner

@ghost commented on GitHub (Jul 22, 2020):

:tada:This issue was addressed in #6506, which has now been successfully released as Windows Terminal Preview v1.2.2022.0.🎉

Handy links:

@ghost commented on GitHub (Jul 22, 2020): :tada:This issue was addressed in #6506, which has now been successfully released as `Windows Terminal Preview v1.2.2022.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.2.2022.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5204