Author Posts

December 5, 2016 at 3:57 pm

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

December 5, 2016 at 4:45 pm

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.

December 5, 2016 at 6:18 pm

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.

December 5, 2016 at 6:49 pm

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

December 5, 2016 at 6:56 pm

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.

December 6, 2016 at 12:38 pm

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.