Color coded syntax?

This topic contains 5 replies, has 4 voices, and was last updated by Profile photo of SavindraSingh Shahoo SavindraSingh Shahoo 5 months, 2 weeks ago.

  • Author
    Posts
  • #59404
    Profile photo of RobertM
    RobertM
    Participant

    Brand new to PowerShell and frustrated. I've searched and can't find answer to what seems like should be a common and obvious question. What is the powershell ise color coding for syntax? What or where is the list? Yes I'm sure it's changeable but in default what do the color alterations of my text tell me for each color? Like Green text is comment, at least I think it is. It seem like the Pink elephant standing in the room. Nobody addresses the obvious. Why is that? All of that good information just blowing right passed me. Also pointers, preferably charts, for fundamental structure of or in Powershell. Visual learner, fewest words possible. Pictures, diagrams, schematics ... help?
    Thank you,
    Newbie

  • #59407
    Profile photo of Jonathan Warnken
    Jonathan Warnken
    Participant

    It is easy to see what the default options are with this command

    $psISE.Options

    And there is documentation on the options
    Sorry but is a wall of text.

    • #59412
      Profile photo of RobertM
      RobertM
      Participant

      Thank you. That was very helpful. Now how do you decipher the $psISE.Options.ConsoleTokenColors values? I know the pattern of 6 digit hex for RGB color but the values given are 8 hex digit? Except for the 3 primary pure saturated colors, I wouldn't know what color it is. Is there a set of 16 or so values chart? Can you CLI request a translation to human name colors?
      Thanks

    • #59415
      Profile photo of Don Jones
      Don Jones
      Keymaster

      It's probably an alpha channel (transparency). And no, there's no preset list of 16 colors, nor does .NET provide a translation function apart from the system Colors enumeration.

    • #59479

      You can try this code:

      $CC = [System.Drawing.ColorConverter]::new()
      [System.Drawing.Color]$CC.ConvertFromString('red')
      

      In above method, you can convert color names into Color objects.

  • #59410
    Profile photo of Don Jones
    Don Jones
    Keymaster

    If you get into the Options menu you can modify the theme, and it shows you what each color-able element is, and how it's presently set. Sorry that I don't have a picture or chart for you, but perhaps that's something you can take on! If it'd help someone else, then making the diagrams might also help you refine you understanding of the product.

You must be logged in to reply to this topic.