Change tab colour automatically based on tab title text using preset regex in settings #10996

Open
opened 2026-01-31 02:35:47 +00:00 by claunia · 9 comments
Owner

Originally created by @fusenuk on GitHub (Oct 13, 2020).

Description of the new feature/enhancement

The ability to preset what colour a tab would be by what text is in the title of the tab.

I regularly have multiple tabs open to different servers but also multiple tabs open to the same server at the same time. An example tab bar could look like

me@laptop, bob@serverA, bob@serverA, bob@serverB, bob@serverC

On top of that I regularly close and open tabs to 'serverA' or 'serverB' throughout the day. So the ability to choose a colour manually for an open tab is useful but the frequency I open and close tabs means it isn't very efficient.

I'd like to be able to put a setting in the settings file that is something like

"tabColours":
{
"serverA" : "red",
"laptop" : "yellow",
"server[B,C]" : "green",
},

Then when I open a new tab and connect to serverB, the tab would automatically switch to the colour green. If I disconnected from ServerB and the Terminal session title changed back to 'me@laptop' the tab colour would auto switch to the colour yellow from green.

Proposed technical implementation details (optional)

Supporting regex pattern matching would be nice but even if it couldn't do that and was just basic static text matching would be good.

Originally created by @fusenuk on GitHub (Oct 13, 2020). # Description of the new feature/enhancement The ability to preset what colour a tab would be by what text is in the title of the tab. I regularly have multiple tabs open to different servers but also multiple tabs open to the same server at the same time. An example tab bar could look like me@laptop, bob@serverA, bob@serverA, bob@serverB, bob@serverC On top of that I regularly close and open tabs to 'serverA' or 'serverB' throughout the day. So the ability to choose a colour manually for an open tab is useful but the frequency I open and close tabs means it isn't very efficient. I'd like to be able to put a setting in the settings file that is something like _"tabColours": { "serverA" : "red", "laptop" : "yellow", "server[B,C]" : "green", },_ Then when I open a new tab and connect to serverB, the tab would automatically switch to the colour green. If I disconnected from ServerB and the Terminal session title changed back to 'me@laptop' the tab colour would auto switch to the colour yellow from green. # Proposed technical implementation details (optional) Supporting regex pattern matching would be nice but even if it couldn't do that and was just basic static text matching would be good.
claunia added the Issue-FeatureProduct-TerminalArea-Extensibility labels 2026-01-31 02:35:48 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Oct 13, 2020):

Okay this is a neat idea, but I'm going to tag this up as a possible extension idea. Thanks for the suggestion!

@zadjii-msft commented on GitHub (Oct 13, 2020): Okay this is a neat idea, but I'm going to tag this up as a possible extension idea. Thanks for the suggestion!
Author
Owner

@DHowett commented on GitHub (Oct 16, 2020):

Yup! Excellent extension idea. Thanks!

@DHowett commented on GitHub (Oct 16, 2020): Yup! Excellent extension idea. Thanks!
Author
Owner

@uishon commented on GitHub (Dec 2, 2020):

A suggestion, support not just the title bar color but some additional (any?) profile attributes (e.g., terminal background color, image, etc.)

@uishon commented on GitHub (Dec 2, 2020): A suggestion, support not just the title bar color but some additional (any?) profile attributes (e.g., terminal background color, image, etc.)
Author
Owner

@luxzg commented on GitHub (Dec 4, 2020):

As @uishon suggested, this should cover other visuals as well, it would nicely cover my case. With multiple tabs, I'd rather rely on backgrond color or image to differentiate quickly, as tab colors just don't pop to me as much. I've been toying with a thing (see 8471 closed link above) to have background that has some noticable graphics + text (eg hostname or IP) in background-image, to help me differentiate sessions easily. Looking forward to seeing progress on this!

@luxzg commented on GitHub (Dec 4, 2020): As @uishon suggested, this should cover other visuals as well, it would nicely cover my case. With multiple tabs, I'd rather rely on backgrond color or image to differentiate quickly, as tab colors just don't pop to me as much. I've been toying with a thing (see 8471 closed link above) to have background that has some noticable graphics + text (eg hostname or IP) in background-image, to help me differentiate sessions easily. Looking forward to seeing progress on this!
Author
Owner

@Hightmar commented on GitHub (Dec 30, 2023):

Very good idea, I'm looking for a solution to do it.
Is it possible to know the status of this feature?

@Hightmar commented on GitHub (Dec 30, 2023): Very good idea, I'm looking for a solution to do it. Is it possible to know the status of this feature?
Author
Owner

@zadjii-msft commented on GitHub (Jan 3, 2024):

There hasn't been any progress here, or any current plan either. There's a spec that's pretty close to this over in #15700 (for #5916), but that doesn't really cover the "tab title".

Otherwise, we've kinda just got this tagged up as an "extensibility" feature (though, we don't really have a plan for extensions either). Maybe someday in the future, a 3p dev could write a "terminal extension" that listens for tab title changes, and then can call some API to manually set the tab color for a control.

Otherwise, I don't think we have a good idea for how to align this feature with our current settings model 🤷

@zadjii-msft commented on GitHub (Jan 3, 2024): There hasn't been any progress here, or any current plan either. There's a spec that's pretty close to this over in #15700 (for #5916), but that doesn't really cover the "tab title". Otherwise, we've kinda just got this tagged up as an "extensibility" feature (though, we don't really have a plan for extensions either). Maybe someday in the future, a 3p dev could write a "terminal extension" that listens for tab title changes, and then can call some API to manually set the tab color for a control. Otherwise, I don't think we have a good idea for how to align this feature with our current settings model 🤷
Author
Owner

@perryrh0dan commented on GitHub (Jan 9, 2024):

Is there already an API to change the tab color from a powershell script ?
I have some helper functions and it would be really cool to change the color from within those functions.

@perryrh0dan commented on GitHub (Jan 9, 2024): Is there already an API to change the tab color from a powershell script ? I have some helper functions and it would be really cool to change the color from within those functions.
Author
Owner

@zadjii-msft commented on GitHub (Jan 9, 2024):

There certainly is! There are probably some details around https://github.com/microsoft/terminal/issues/6574#issuecomment-1176574114 for the sequence you'd want to use

@zadjii-msft commented on GitHub (Jan 9, 2024): There certainly is! There are probably some details around https://github.com/microsoft/terminal/issues/6574#issuecomment-1176574114 for the sequence you'd want to use
Author
Owner

@perryrh0dan commented on GitHub (Jan 9, 2024):

Awesome, thank you so much for. Really appreciated :)

@perryrh0dan commented on GitHub (Jan 9, 2024): Awesome, thank you so much for. Really appreciated :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10996