Farrukh Waheed
Farrukh Waheed

Reputation: 2193

Powershell: Can we change Write-Progress UI?

Is it possible to change Write-Progress color scheme and other UI things, like progress bar?

Presently, its light green with a progress bar composed of "O"... And I want to change the color (or remove the color) and replace that "O" with something else.

Upvotes: 6

Views: 5115

Answers (2)

Χpẘ
Χpẘ

Reputation: 3451

The letter "o" is hardcoded within the class Microsoft.PowerShell.ProgressNode, in the method RenderFull. The class is in the Microsoft.PowerShell.ConsoleHost assembly.

If you really want to change the "o" you could write your own host. I have seen several questions about custom hosts on SO and MS has it documented on the MSDN website.

Upvotes: 4

alroc
alroc

Reputation: 28204

You can change the foreground and background colors of the Write-Progress output by modifying the ProgressForegroundColor and ProgressBackgroundColor of the $host.privatedata ConsoleColorProxy object.

For example, if you really hate your eyes:

$host.privatedata.ProgressForegroundColor = "darkgreen";
$host.privatedata.ProgressBackgroundColor = "red";

Upvotes: 10

Related Questions