In my job I have recently begun using Powershell quite frequently. To facilitate using it, I am attempting to customize the command prompt colors to my liking, but I have run into a snag when attempting to customize the color of quoted string values. Given how PS is a text based interface, this statement may not mean that much, so please refer to this
Apparently I can't embed images yet, so you'll have to click the link. Anyway, this text is extremely difficult for me to read, and I am attempting to switch it over to something with more contrast, but I can't find a setting for it.
I've looked at the following options already:
$host.UI.RawUI
, but this also only allows setting the default foreground and backgroundMy fallback plan is to use PowerShell ISE if I must (it allows me to customize this), but I would prefer to have a lighter weight command prompt available if possible.
Has anyone figured out how to change this?
I'm using PowerShell v5 on Windows 10.
PowerShell 5.0 ships with PSReadLine, a module that enhances the editing experience in the console by adding syntax highlight coloring among other things.
You can change the color of string tokens with Set-PSReadLineOption
, for example:
Set-PSReadlineOption -TokenKind String -ForegroundColor Cyan
For PSReadLine version 2.0 and up, use the -Colors
parameter and supply a dictionary of (optional) token color overrides to Set-PSReadLineOption
:
Set-PSReadLineOption -Colors @{ String = 'Cyan' }