[PR #13058] Add support for the DECAC escape sequence #29372

Open
opened 2026-01-31 09:34:30 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/13058

State: closed
Merged: Yes


The DECAC (Assign Colors) escape sequence controls which color table
entries are associated with the default foreground and background
colors. This is how you would change the default colors on the the
original DEC VT525 terminals.

But DECAC also allows you to assign the color table entries for the
"window frame", which in our case is mapped to the tab color (just the
background for now). So this now gives us a way to control the tab color
via an escape sequence as well.

DETAILS

The way this works is there are now two new entries in the color table
for the frame colors, and two new aliases in the color alias table that
are mapped to those color table entries. As previously mentioned, only
the background is used for now.

By default, the colors are set to INVALID_COLOR, which indicates that
the system colors should be used. But if the user has set a tabColor
property in their profile, the frame background will be initialized with
that value instead.

And note that some of the existing color table entries are now
renumbered for compatibility with XTerm, which uses entries 256 to 260
for special colors which we don't yet support. Our default colors are
now at 261 and 262, the frame colors are 263 and 264, and the cursor
color is 265.

So at runtime, you can change the tab color programmatically by setting
the color table entry at index 262 using OSC 4 (assuming you need a
specific RGB value). Otherwise if you just want to set the tab color to
an existing color index, you can use DECAC 2.

You can even make the tab color automatically match background color by
mapping the frame background alias to the color table entry for the
default background, using DECAC 2;261;262 (technically this is mapping
both the the foreground and background).

This PR doesn't include support for querying the color mapping with
DECRQSS, and doesn't support resetting the colors with RIS, but
hopefully those can be figured out in a future PR - there are some
complications that'll need to be resolved first.

Validation Steps Performed

I've added a basic unit test that confirms the DECAC escape sequence
updates the color aliases in the render settings as expected. I've also
manually confirmed that the tab color in Windows Terminal is updated by
DECAC 2, and the default colors are updated in both conhost and WT
using DECAC 1.

Closes #6574

**Original Pull Request:** https://github.com/microsoft/terminal/pull/13058 **State:** closed **Merged:** Yes --- The `DECAC` (Assign Colors) escape sequence controls which color table entries are associated with the default foreground and background colors. This is how you would change the default colors on the the original DEC VT525 terminals. But `DECAC` also allows you to assign the color table entries for the "window frame", which in our case is mapped to the tab color (just the background for now). So this now gives us a way to control the tab color via an escape sequence as well. DETAILS ------- The way this works is there are now two new entries in the color table for the frame colors, and two new aliases in the color alias table that are mapped to those color table entries. As previously mentioned, only the background is used for now. By default, the colors are set to `INVALID_COLOR`, which indicates that the system colors should be used. But if the user has set a `tabColor` property in their profile, the frame background will be initialized with that value instead. And note that some of the existing color table entries are now renumbered for compatibility with XTerm, which uses entries 256 to 260 for special colors which we don't yet support. Our default colors are now at 261 and 262, the frame colors are 263 and 264, and the cursor color is 265. So at runtime, you can change the tab color programmatically by setting the color table entry at index 262 using `OSC 4` (assuming you need a specific RGB value). Otherwise if you just want to set the tab color to an existing color index, you can use `DECAC 2`. You can even make the tab color automatically match background color by mapping the frame background alias to the color table entry for the default background, using `DECAC 2;261;262` (technically this is mapping both the the foreground and background). This PR doesn't include support for querying the color mapping with `DECRQSS`, and doesn't support resetting the colors with `RIS`, but hopefully those can be figured out in a future PR - there are some complications that'll need to be resolved first. ## Validation Steps Performed I've added a basic unit test that confirms the `DECAC` escape sequence updates the color aliases in the render settings as expected. I've also manually confirmed that the tab color in Windows Terminal is updated by `DECAC 2`, and the default colors are updated in both conhost and WT using `DECAC 1`. Closes #6574
claunia added the pull-request label 2026-01-31 09:34:30 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29372