Support ANSI in tab title #14903
Replies: 3 comments 2 replies
-
You can set the color indices of the tab with a
For example, in PowerShell, if you wanted to set the colors to white (index 15) on red (index 1), you would do this:
In the current implementation, the foreground index is ignored - it'll automatically choose a color that'll show up over the given background color - but it's best to use a meaningful value anyway, because at some point in the future it may actually take effect. The other option is to override the palette entries of the default indices assigned to the tab, which in Windows Terminal are 263 and 264, i.e. if you update palette entry 264, that should change the tab's background color. Again, the foreground color isn't used at the moment, but it may be in the future. There are two escape sequences you can use for this, the DEC color table report (
And the equivalent
But note that in this case the RGB components are decimal values in the range 0 to 100, so the color precision is somewhat smaller. For both of these, I'm assuming you haven't already overridden the default indices for the tab colors. Otherwise you'll first need to reset them like this:
|
Beta Was this translation helpful? Give feedback.
-
I see. Not sure I completely follow all of this, but I'm looking at what I think is the relevant PR #13058 |
Beta Was this translation helpful? Give feedback.
-
To be clear, I want to use ANSI escape sequences in the tab text, not the color of the tab. I want to be able to do something like this: $t = "`e[91mPS7-Admin`e[0m"
$host.ui.RawUI.WindowTitle = $t |
Beta Was this translation helpful? Give feedback.
-
Would it be possible to support ANSI sequences in tab titles? I'm trying out some PowerShell code to dynamically update the tab and I'd love to be able to use use ANSI color sequences.
Beta Was this translation helpful? Give feedback.
All reactions