A PowerShell window looks pretty unified when it starts up. Especially if there are multiple windows open at the same time it might be helpful if they were distinguishable. Like a different color as the background, or a specific title of the window goes a long way to make it obvious which window we want to work with.
1. Set title, background and text color
To set the title and color scheme of a PowerShell window, we simply have to set the appropriate values for the built-in $Host system management variable, more specifically it's UI and RawUI properties, which keeps the values of the console window. Let's take a look:
PS C:\> $Host.UI.RawUI ForegroundColor : DarkYellow BackgroundColor : DarkMagenta CursorPosition : 0,1 WindowPosition : 0,0 CursorSize : 25 BufferSize : 140,3000 WindowSize : 140,40 MaxWindowSize : 140,50 MaxPhysicalWindowSize : 195,50 KeyAvailable : False WindowTitle : Administrator: Windows PowerShell PS C:\>
Here we are only interested it the ForegroundColor, BackgroundColor and WindowTitle properties, setting the background white, the text color black and the title to "Monochrome Window"
$console = $Host.UI.RawUI $console.WindowTitle = "Monochrome Window" $console.BackgroundColor = "white" $console.ForegroundColor = "black" Clear
2. Result
The result looks like this:
Feel free to experiment with more colors, here is a list of the available palette in PowerShell:
Comments