Highlight terminal output based on regex pattern #13644

Closed
opened 2026-01-31 03:48:12 +00:00 by claunia · 6 comments
Owner

Originally created by @mikhail-naumenko on GitHub (Apr 27, 2021).

Description of the new feature/enhancement

That would be really handy to have an ability to apply some custom highlighting to terminal output.
For example when I read logs generated by some application I want to highlight particular feature name I'm interested in. So if logs of this feature start with Info: [Feature name] log message, I want to highlight "[Feature name]" with yellow.

That should be an ability to specify various highlighting rules. E.g. I have the following outputs
error: [feature 1] error message here
warning: [feature 2] some another message
info: [feature 3] yet another message

In this case I want to highlight "error:" with red, "warning:" with yellow, "info with green and "debug" with blue. And of course that would be cool if I highlight different features with different colors.

Just to emphasize. That is not mandatory that patterns are at the beginning of the string. It could be in any part of the string.

Proposed technical implementation details

A set of rules in settings.json which associate regex pattern with color. E.g.:

{
    "highlightRules": [
        "pattern": "^error:",
        "color": "red"
    ], [
        "pattern": "\[feature name\]",
        "color": "#deab1f"
    ], [
        "pattern" "^(?:\d{2,4}-?)+\s(?:\d{2,3}[:\.]?)+", // date pattern
        "color": "#34ebe1"
    ]
}
Originally created by @mikhail-naumenko on GitHub (Apr 27, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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! --> # Description of the new feature/enhancement That would be really handy to have an ability to apply some custom highlighting to terminal output. For example when I read logs generated by some application I want to highlight particular feature name I'm interested in. So if logs of this feature start with Info: [Feature name] log message, I want to highlight "[Feature name]" with yellow. That should be an ability to specify various highlighting rules. E.g. I have the following outputs error: [feature 1] error message here warning: [feature 2] some another message info: [feature 3] yet another message In this case I want to highlight "error:" with red, "warning:" with yellow, "info with green and "debug" with blue. And of course that would be cool if I highlight different features with different colors. Just to emphasize. That is not mandatory that patterns are at the beginning of the string. It could be in any part of the string. <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> # Proposed technical implementation `details` A set of rules in `settings.json` which associate regex pattern with color. E.g.: ``` { "highlightRules": [ "pattern": "^error:", "color": "red" ], [ "pattern": "\[feature name\]", "color": "#deab1f" ], [ "pattern" "^(?:\d{2,4}-?)+\s(?:\d{2,3}[:\.]?)+", // date pattern "color": "#34ebe1" ] } ``` <!-- A clear and concise description of what you want to happen. -->
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 03:48:12 +00:00
Author
Owner

@skyline75489 commented on GitHub (Apr 27, 2021):

Similar request: #7561

@skyline75489 commented on GitHub (Apr 27, 2021): Similar request: #7561
Author
Owner

@skyline75489 commented on GitHub (Apr 27, 2021):

#7561 and #3920 both focus on highlighting search result. Do people really want to highlight output (of certain pattern) all the time ? I don't know. I feel colored output is good enough for me personally.

@skyline75489 commented on GitHub (Apr 27, 2021): #7561 and #3920 both focus on highlighting *search* result. Do people really want to highlight output (of certain pattern) *all the time* ? I don't know. I feel colored output is good enough for me personally.
Author
Owner

@mikhail-naumenko commented on GitHub (Apr 27, 2021):

#7561 and #3920 both focus on highlighting search result. Do people really want to highlight output (of certain pattern) all the time ? I don't know. I feel colored output is good enough for me personally.

Yes that would be good to highlight output on regular basis and the difference of this request from #7561 is that you wouldn't have any dialog open when output is highlighted.

That would be also cool if that could look more like code highlighting then search results highlighting.

@mikhail-naumenko commented on GitHub (Apr 27, 2021): > > > #7561 and #3920 both focus on highlighting _search_ result. Do people really want to highlight output (of certain pattern) _all the time_ ? I don't know. I feel colored output is good enough for me personally. Yes that would be good to highlight output on regular basis and the difference of this request from #7561 is that you wouldn't have any dialog open when output is highlighted. That would be also cool if that could look more like code highlighting then search results highlighting.
Author
Owner

@zadjii-msft commented on GitHub (Apr 29, 2021):

Yea, generally we're tracking this in #3920 and linked threads. I know #8294 mentions "links", but I think a lot of what that's tracking would apply to even not links.

/dup #7561
/dup #3920
/dup #8294

@zadjii-msft commented on GitHub (Apr 29, 2021): Yea, generally we're tracking this in #3920 and linked threads. I know #8294 mentions "links", but I think a lot of what that's tracking would apply to even not links. /dup #7561 /dup #3920 /dup #8294
Author
Owner

@ghost commented on GitHub (Apr 29, 2021):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Apr 29, 2021): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@jonny64 commented on GitHub (Sep 16, 2025):

impact: find errors faster

this is not the same as highlight find results, just try it

@jonny64 commented on GitHub (Sep 16, 2025): * mobaxterm has this feature https://stackoverflow.com/questions/64391031/how-to-use-customize-syntax-highlighting-on-mobaxterm * it has by default pretty good defaults: highlight err* warn* etc impact: find errors faster this is not the same as highlight find results, just try it
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13644