You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I played a bit with it and added coloring of regex groups and after having used it for a few months, I have to say that it is very useful. Instead of a wall of text, it is really easy to distinguish the things you're looking for.
How about making some version of this ship with the platform?
Reacted by Ben Gelens, nzbart, Andrew Childs, Michael Klement, Konstantin Khabarlak, Xiang ZHU, Sindre T. Strøm, Rain Sallow (/u/ta11ow), Felix Becker, Mariusz Pawelski and 1 more
Most won't notice, but there is a small issue that we should consider in the formatting engine before using color in any default formatting.
If you change your foreground/background colors, the "reset color" ANSI escape sequence (CSI 0 m) doesn't work as expected. For example, I have the following in my profile (using my unpublished module ConsoleUtilities)
Import-Module-Name ConsoleUtilities
Set-ConsoleColorTable-ColorTable @{
Black='#141414'Blue='#004bff'Cyan='#00ffff'DarkBlue='#374b80'DarkCyan='#008080'DarkGray='#808080'DarkGreen='#008000'DarkMagenta='#800080'DarkRed='#C81010'DarkYellow='#808000'Gray='#c0c0c0'Green='#00ff00'Magenta='#ff00ff'Red='#ff0000'White='#ffffff'Yellow='#ffff00'
} -TextForegroundColor Gray -TextBackgroundColor Black
If I start PowerShell from the regular shortcut that has the royal blue background, my suggested implementation for highlighting matches causes weird things to happen.
I'm not sure if this issue should be considered a PowerShell bug or conhost bug, but I do think PowerShell needs to provide a good experience for folks that customize their consoles like I do.
And how should we think about the new console with full RGB support?
Seems wrong to limit ourselves to the small set of named console colors.
Should there be a set of named, configurable, 'highlight' colors?
They could be configured to work well on what is shipping out of the box, but tweakers could set them according to their preferences.
It couldn't be just formatting because it changes the output and has multiple lines, but it does go usefully further in explaining how the group names match up against the input test.
e.g. Select-String could get an -ExplainMatch switch which makes it take the first match and output something like this.
Activity
iSazonov commentedon Dec 19, 2016
Looks superb!
We must help our eyes.
It would be nice to paint all output.
Maybe make the individual format color views for other types?
lzybkr commentedon Dec 22, 2016
Most won't notice, but there is a small issue that we should consider in the formatting engine before using color in any default formatting.
If you change your foreground/background colors, the "reset color" ANSI escape sequence (CSI 0 m) doesn't work as expected. For example, I have the following in my profile (using my unpublished module ConsoleUtilities)
If I start PowerShell from the regular shortcut that has the royal blue background, my suggested implementation for highlighting matches causes weird things to happen.
I'm not sure if this issue should be considered a PowerShell bug or conhost bug, but I do think PowerShell needs to provide a good experience for folks that customize their consoles like I do.
powercode commentedon Dec 22, 2016
And how should we think about the new console with full RGB support?
Seems wrong to limit ourselves to the small set of named console colors.
Should there be a set of named, configurable, 'highlight' colors?
They could be configured to work well on what is shipping out of the box, but tweakers could set them according to their preferences.
lzybkr commentedon Dec 22, 2016
Discussion about color support is in #2381
HumanEquivalentUnit commentedon Oct 3, 2017
I saw this recently https://twitter.com/LincolnAtkinson/status/907708171728257024 (Code here) and it's related.
It couldn't be just formatting because it changes the output and has multiple lines, but it does go usefully further in explaining how the group names match up against the input test.
e.g.
Select-Stringcould get an-ExplainMatchswitch which makes it take the first match and output something like this.derek-xia commentedon Feb 23, 2019
I'm at HackIllinois right now and I'd like to take a look at this issue.
itpropaul commentedon Aug 27, 2019
Get this out the door. Color highlighting with Select-String should have been included from the beginning. Please Please make this a priority!
This is the top hit in Google when searching: "select-string highlighting" https://copdips.com/2018/05/grep-like-powershell-colorful-select-string.html
ThomasNieto commentedon Feb 26, 2020
Ilya (@iSazonov) the emphasis logic was merged, can this issue be closed?