PowerShell colors ForeGround, BackGround, Error Fore and Background

Use different colors for ForeGround, BackGround, Error Foreground and Background using PowerShell Colors latest method. Working more scripts for colors!

PowerShell Colors

In this post, we are going to see how to change the PowerShell colors.  There are not many options when it comes to changing the PowerShell colors.  We can see the available list of colors using the following instructions.

Jump to:

List of Colors in PowerShell:

We can use the below script for displaying the list of colors in PowerShell.

[system.enum]::GetValues(‘consolecolor’) | %{ Write-host $_ -ForegroundColor $_}

The output of the above script is shown in the image.

available colors
available colors

From this, it is clear that there are not many colors to choose from when it comes to change the PowerShell Shell properties.

We can assign different colors to different aspects of PowerShell.

Set PowerShell Colors:

Below is a list of variables that should be set in order to manipulate the PowerShell color scheme.


The colors of a specific property are set using the corresponding property.

We can modify the earlier script to check the different colors that might suit the background.

[system.enum]::GetValues(‘consolecolor’) | %{ Write-host $_ -BackgroundColor $_}

The script is given in above that can be used to apply different background colors for the

The output of the above script is given below.

PowerShell background colors
PowerShell background colors

We can modify the same script to set the error foreground and error background as shown below.

[system.enum]::GetValues(‘consolecolor’) | %{ $Host.PrivateData.ErrorForegroundColor = $_

error background color
error foreground color

The output of the above script is given in the image.  Now we can go ahead and change the error background color in the same way.

[system.enum]::GetValues(‘consolecolor’) | %{ $Host.PrivateData.ErrorBackgroundColor = $_

error background color
error background color


We learned about the different colors that are available in PowerShell.  We can use those colors to modify the different properties of PowerShell.  The different properties are accessed using the $host variable.  We can change the foreground color, background color, error foreground color and more.

If you want to know more about windows and Powershell, stay tuned to TecKangaroo.

Leave a Reply

Your email address will not be published. Required fields are marked *