Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

PSReadLine in PowerShell has syntax coloring, but how do you specify the colors?

share|improve this question
up vote 3 down vote accepted

There are a couple different ways. You can do this:

Set-PSReadlineOption -TokenKind Comment -ForegroundColor Green


$options = Get-PSReadlineOption
$options.CommentForegroundColor = Green

The possible colors are from the .NET ConsoleColor Enumeration. The actual RGB color values can be changed in the console properties dialog.

To see the current color settings, execute Get-PSReadlineOption by itself.

share|improve this answer
Great. Thanks. Do you know if there's any way to specify numeric RGB colors? – dangph Nov 16 '13 at 13:24
Not with PSReadline. There are only 16 possible colors available in the console. The RGB values are stored in the registry and typically changed in the Properties dialog of the console. ConsoleColor (a .Net enum) is really just an index into one of those 16 possible colors - so the name doesn't matter - if you change the right entry, it will just read the registry for that slot. – Jason Shirk Nov 16 '13 at 17:45
Jason, thanks once again. Good info. – dangph Nov 18 '13 at 0:43
Hello, I can't find a way to set those colors in my profile file. It seems Get-PSReadlineOption is not defined and return nothing when executed from the profile file. Once the shell is loaded, there's no problem however. I tried adding an implicit Import-Module PSReadline before those lines but nothing do. – Cyril Duchon-Doris May 14 at 9:29

To get rid of the black blackgrounds of the text when using PSReadLine in ConEmu and using the "PowerShell" color scheme:

  1. Select the "PowerShell" color scheme in Settings.
  2. Restart ConEmu.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.