Color Week: Setting PowerShell ISE Background Color

by Sep 14, 2016

This week we are looking at how you can change coloring both in the PowerShell console and PowerShell ISE so you can fine tune your PowerShell environment.

In the previous tip we explained how you can set the PowerShell ISE console foreground color, and define the color by specifying red, green, and blue values.

The same works for the PowerShell ISE console background color, too, but has some side effects that need to be worked around.

Let’s first switch the PowerShell ISE Console Pane colors to a light gray foreground and a deep green background:

PS C:\> $psise.Options.ConsolePaneForegroundColor =
[System.Windows.Media.Colors]::LightGray
 
PS C:\> $psise.Options.ConsolePaneBackgroundColor =
[System.Windows.Media.Colors]::DarkGreen

PS C:\>
PS C:\>"Hello"
Hello
 
PS C:\>

The colors change, but the prompt and all other output still retains the old color. That’s because there is a third setting in PowerShell ISE, determining the text background color:

PS C:\>$psise.Options.ConsolePaneTextBackgroundColor =
[System.Windows.Media.Colors]::DarkGreen
 
PS C:\> "Hello"
Hello

Now all looks perfect.

Twitter This Tip! ReTweet this Tip!