• Powershell syntax highlighting

    Home » Forums » AskWoody support » Windows » Windows 10 » Questions: Win10 » Powershell syntax highlighting

    Author
    Topic
    #502723

    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.)

    Viewing 5 reply threads
    Author
    Replies
    • #1532984

      My PowerShell is white lettering on dark blue background. Syntax highlighting poses no problems.

    • #1532992

      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.

      42343-ps

    • #1532993

      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…

    • #1532997

      Cafed00d,

      Here’s the general method.

      [noparse]Set-PSReadlineOption -TokenKind Comment -ForegroundColor Gray[/noparse]

      To get the Tokens use:

      Get-psreadlineoption

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

      HTH :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1532998

      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.

    • #1532999

      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! 😆 :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    Viewing 5 reply threads
    Reply To: Powershell syntax highlighting

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: