Why isn’t my console background blue?

by Aug 12, 2009

Maybe you have noticed that some PowerShell consoles have a nice blueish background while others default to black. Actually, the blueish background is defined in the PowerShell link Microsoft has placed into your start menu. So if you launch PowerShell from there, it is blue, and if you call powershell.exe directly, it is black.

There are limited ways of setting the background color from within PowerShell:

$host.UI.RawUI.BackgroundColor = "Blue"clear-host

Simply replace "Blue" with "Whatelse" to get a list of available colors (actually you get an error, but the error message explains valid values). Or in PowerShell Plus, enter

$host.UI.RawUI.BackgroundColor =

and then press TAB.

This is not the same blue PowerShell consoles normally use. The reason: the console has 16 predefined colors, and there is no programmatic way to change those. You can, however, change the colors in the property dialog. Right-click the small icon at the left side of the title bar, choose Properties and click the Colors tab. Select Screen Background, and there you go: click one of the 16 color buckets, and mix a color with the three color text boxes to the right.

The "true" PowerShell background color is composed of Red=1, Green=36 and Blue=86.

Twitter This Tip! ReTweet this Tip!