PowerShell – Hate The Error Text And Warning Text Colors? Change It!

How could such a nice tool have such a terrible choice of colors for errors and warnings? I am talking about the ISE and the unreadable contrast of colors.

You can fix it. Open and update your profile by running this from your ISE (which opens your profile in NotePad)
notepad $profile

#
# Change the color of error and warning text
#
$opt = (Get-Host).PrivateData
$opt.WarningBackgroundColor = "Orange"
$opt.WarningForegroundColor = "white"
$opt.ErrorBackgroundColor = "red"
$opt.ErrorForegroundColor = "white"

Add the above to your profile. Save. Your ISE will have better colors for errors and warnings going forward (after a restart). For it to take effect immediately, just run it.

As a matter of fact, this is the color combination I have been using for a while and I cringe every time I see the default error/warning colors.

These colors are much better for Error and Warning – IMHO

PS C:\Windows\system32> Write-Error “This is a test error to show the error colors!”

[0,0: Write-Error] This is a test error to show the error colors!

PS C:\Windows\system32> Write-Warning “This is a test warning to show the warning colors!”

WARNING: This is a test warning to show the warning colors!

PS C:\Windows\system32>                

Advertisements

One thought on “PowerShell – Hate The Error Text And Warning Text Colors? Change It!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s