Home Ask Login Register

Developers Planet

Your answer is one click away!

user3763544 February 2016

How to turn off syntax highlighting in console?

I just want PowerShell to be black text on a white background. However, PowerShell v5 highlights my commands and makes them yellow, which is impossible to see. Is there a way to turn off ALL syntax highlighting in PowerShell?


Ansgar Wiechers February 2016

Syntax coloring in PowerShell v5 can be modified via Set-PSReadlineOption. The following command sets the foregound and background color for comments to the shell foreground and background color:

Set-PSReadlineOption -TokenKind Comment -ForegroundColor $Host.UI.RawUI.ForegroundColor -BackgroundColor $Host.UI.RawUI.BackgroundColor

or just black and white:

Set-PSReadlineOption -TokenKind Comment -ForegroundColor Black -BackgroundColor White

You need to do this for all TokenKind values to remove syntax coloring entirely.

If you also want to change output stream colors you can do that via the properties of the host's PrivateData object:

$Host.PrivateData.WarningForegroundColor = $Host.UI.RawUI.ForegroundColor
$Host.PrivateData.WarningBackgroundColor = $Host.UI.RawUI.BackgroundColor

Put all of these statements into your profile to get them applied every time you start PowerShell, e.g.:


Post Status

Asked in February 2016
Viewed 3,081 times
Voted 9
Answered 1 times


Leave an answer

Quote of the day: live life