Note: The following was tested with PowerGUI 3.8.0.129.
As I have gotten more confident with Powershell, my scripts have grown longer and longer. I use PowerGUI as my IDE of choice and I have been quite happy with it. One of the problems I’ve increasingly run into however is that as the code grows in length, it becomes harder to visually read and follow the code to pinpoint what you want to work on. I know that Powershell supports the Region/EndRegion commands but that still made it difficult to distinguish one section from another visually. I looked into alternatives but after fairly extensive Google searches was surprised to find on one else commenting on this. I did however find a PowerGUI addon called “Script Colors”. Unfortunately that didn’t offer any configuration for the region command but did discover that this script was just making modifications to an XML configuration file. I then decided I’d see if I couldn’t tackle this myself. Before we delve into how to do this though, let me show you what the end goal is.
The first screenshot below is of the default color scheme in PowerGUI. (Note the code is random gibberish and is there only to fill space for the purposes of this demonstration)