How do I turn off syntax highlighting on Windows powershell?

Viewed 31

I"m using Windows PowerShell on Windows 10. Although I have been able to adjust background and most foreground colors,

enter image description here

I can't seem to figure out how to turn off syntax highlighting or change the colors

enter image description here

Where is this setting located?

1 Answers

The dynamic syntax highlighting comes from the PSReadLine module that ships with PowerShell in Windows 10.

You can "reset" all the token colors to whatever the console host application uses:

# Prepare a dictionary to hold all the new token-color mappings
$colorMap = @{}

# Fetch the possible coloring options
Get-PSReadLineOption |Get-Member *Color -MemberType Property |ForEach-Object {
    # Add a mapping to our dictionary that overrides the existing setting with whatever foreground color is used by the console
    $colorMap[$_.Name -replace 'Color$'] = [Console]::ForegroundColor
}

# Use the dictionary to update the highlighting settings
Set-PSReadLineOption -Colors $colorMap
Related