Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Jan 2010
    Location
    Los Angeles, CA
    Posts
    828
    Thanks
    4
    Thanked 38 Times in 34 Posts

    Powershell syntax highlighting

    I quite often open the powershell command line to enter ad-hoc commands. My problem is that in prior versions of Windows I always changed the powershell command line window color scheme to black (or dark blue) text on a white background. Unfortunately, in Win10, the powershell command line does syntax highlighting, and using a white background makes most text unreadable due to the syntax hightlighting (white, yellow and light grey text are impossible to read). But even the original color scheme is lacking because quite often the contrast between the text and the background is way too low making the text hard to read. In short, this is a nightmare.

    So my question: does anyone know how to either turn off the powershell command line syntax highlighting, or to change the syntax highlighting color scheme?

    BTW, the PowerShell ISE uses a white background for its editor window, and I find the syntax highlighting there poses no problem. Why couldn't the folks at MS have used the same color scheme for the powershell command line? That would have been great. (P.S. I'm happy that they finally changed the default color scheme for the command prompt to black on white; the prior white on black scheme always bugged me and I always had to change it.)

  2. #2
    3 Star Lounger djohnson's Avatar
    Join Date
    Dec 2009
    Location
    Delaware City, Delaware
    Posts
    323
    Thanks
    13
    Thanked 32 Times in 30 Posts
    My PowerShell is white lettering on dark blue background. Syntax highlighting poses no problems.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2010
    Location
    Los Angeles, CA
    Posts
    828
    Thanks
    4
    Thanked 38 Times in 34 Posts
    The title, prompt and output are white on dark blue, but once you start typing a command, the command is colored. For example, the command:

    $a = "abcd"

    The $a is a light green, the = is medium grey, the "abcd" is a medium cyan. Only the $a has enough contrast to be clearly visible without squinting.

    ps.png

  4. #4
    Super Moderator Rick Corbett's Avatar
    Join Date
    Dec 2009
    Location
    South Glos., UK
    Posts
    2,143
    Thanks
    101
    Thanked 580 Times in 464 Posts
    Use Console2 or Zenburn front-ends? More info here...

    Console2

    Zenburn (Download from GitHub here.)

    From reading around it seems both can be used with PowerShell.

    Hope this helps...

  5. #5
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Cafed00d,

    Here's the general method.

    Set-PSReadlineOption -TokenKind Comment -ForegroundColor Gray

    To get the Tokens use:

    Get-psreadlineoption

    When you figure out your color scheme place the commands in your Profile.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  6. The Following User Says Thank You to RetiredGeek For This Useful Post:

    cafed00d (2015-10-17)

  7. #6
    5 Star Lounger
    Join Date
    Jan 2010
    Location
    Los Angeles, CA
    Posts
    828
    Thanks
    4
    Thanked 38 Times in 34 Posts
    Thanks, RG! That was it! I knew there must be a cmdlet to set this, just didn't know what it was. You really came through, much appreciated.

  8. #7
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Cafed00d,

    Glad to be able to return the favors you've done for me in the past. I think you're still up quite a few!
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •