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?
After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.
You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.
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.:
$HOME\Documents\WindowsPowerShell\profile.ps1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With