Color Week: Setting PowerShell ISE Console Colors

by Sep 12, 2016

PowerShell 3+

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.

You can change the PowerShell ISE console background and foreground color using the $host object, yet this only gives you 16 predefined colors to choose from:

 
PS> $host.UI.RawUI.ForegroundColor = 'Red'

PS> $host.UI.RawUI.ForegroundColor = 'White'

PS>
 

These commands change the foreground color first to red, then back to white.

In the PowerShell ISE, you can change these colors with the $psISE variable, too. Here you can compose your very own background and foreground colors using RGB values. Let’s change the PowerShell ISE console foreground color to something different:

 
PS> $psise.Options.ConsolePaneForegroundColor = '#FFDD98'

PS> $psise.Options.ConsolePaneForegroundColor = '#FFFFFF'
 

The first line switches the foreground color to a greenish color, the next line switches back to white.

A color can be composed by specifying three hexadecimal values, representing the amount of red, green, and blue color to mix together.

Twitter This Tip! ReTweet this Tip!