how to change output color of powershell command

218 views Asked by At

I want to change the color of output in Powershell intelligently, but it seems there is no way. For example: "grep --help" would give me help information in white color, but I want to highlight some words like "NO", "Except for" and short/long arguments. The original color engine only works in cmdlet implement; they cannot process the color of other program's output. So, is there a way to call my callback function before the output of a command is print to the console so that I can change something easily? For example: My powershell shows "rg -h" like: enter image description here

But another opensource terminal holding powershell shows "rg -h" like: enter image description here

how to make my native powershell behaves just like the later?

0

There are 0 answers