Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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

Set-PSReadlineOption -TokenKind Comment -ForegroundColor Green

Alternatively:

$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

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

 
discard

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.