6

When I type a message into powershell such as git commit -m 'Commit msg' I'm unable to see the -m due to syntax highlighting.
Is there a way to disable this feature or change the colors it is using?

Everything I can find online regarding syntax highlighting in powershell seems to be about programming scripts and is unrelated.

enter image description here

3 Answers 3

6

You can edit/customize this feature using the following commandlet:

Set-PSReadlineOption

In the example you posted, the parameter -m is invisible due to your dark console background color, so you would want to change the parameter foreground color like in the following example:

Set-PSReadlineOption -TokenKind Parameter -ForegroundColor Blue

Obviously you can replace "Blue" in the above command with your desired color. I have included the list of colors which can be used for console enumeration as well as the different tokens which can be modified below.

List of Console Enumeration Colors

Black   
Blue    
Cyan    
DarkBlue    
DarkCyan    
DarkGray    
DarkGreen   
DarkMagenta
DarkRed 
DarkYellow  
Gray    
Green   
Magenta 
Red 
White   
Yellow  

List of tokens (found by using the Get-PSReadlineOption commandlet)

DefaultTokenForegroundColor            : DarkYellow
CommentForegroundColor                 : Green
KeywordForegroundColor                 : Green
StringForegroundColor                  : DarkCyan
OperatorForegroundColor                : DarkGray
VariableForegroundColor                : Green
CommandForegroundColor                 : Yellow
ParameterForegroundColor               : DarkGray
TypeForegroundColor                    : Gray
NumberForegroundColor                  : White
MemberForegroundColor                  : White
DefaultTokenBackgroundColor            : DarkMagenta
CommentBackgroundColor                 : DarkMagenta
KeywordBackgroundColor                 : DarkMagenta
StringBackgroundColor                  : DarkMagenta
OperatorBackgroundColor                : DarkMagenta
VariableBackgroundColor                : DarkMagenta
CommandBackgroundColor                 : DarkMagenta
ParameterBackgroundColor               : DarkMagenta
TypeBackgroundColor                    : DarkMagenta
NumberBackgroundColor                  : DarkMagenta
MemberBackgroundColor                  : DarkMagenta
EmphasisForegroundColor                : Cyan
EmphasisBackgroundColor                : DarkMagenta
ErrorForegroundColor                   : Red
ErrorBackgroundColor                   : DarkMagenta
1

If you run PowerShell in ConEmu, you can change the actual RGB values of the colors.

Some screenshots from the ConEmu web site:

enter image description here enter image description here

0

You can try concfg for getting preset themes/settings. https://github.com/lukesampson/concfg/blob/master/README.md

1
  • You can try or this will do that for sure? Answers should be verified to work as expected before posting as an answer. Sep 3, 2017 at 17:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .