Friday Fun: Theme Me Up!

crayonsWhen PowerShell 3.0 came out, one of the compelling features was a re-vamped PowerShell ISE. Options in the ISE included the ability to fine-tune and customize the appearance including items like font, token colors, and screen colors.

If I recall correctly, in PowerShell 2.0, if you wanted to customize the appearance, you needed to add commands like this to your ISE profile script.

In fact, back then I came across a cool script from Thomas Lee. His script was a PowerShell version of something another person had posted on creating a VIM looking editor in the PowerShell ISE. After working with it for a bit, I made a few changes to handle some different file types and situations. This is my version of that script.

If you run the script in the ISE, it will turn into this:

ise-vimtheme

If you are still running PowerShell 2.0, you would need to use this script. Actually, you can use it in v3 and v4 as well. Or, in those versions you can also import themes. A theme is a ps1xml file that contains all the necessary appearance definitions. I went ahead and exported my VIM theme to a file. Save this file with a .ps1xml extension, like VIM_Theme.ps1xml. Then open the PowerShell ISE and go to Tools – Options. On the Colors and Fonts tab click Manage Themes. Click Import and get the ps1xml file. This will import it into the ISE. You might have to select the theme from the list and click OK to apply it.

You only have to do this once. From now on, every time you start the ISE you’ll get this theme. If you want to get rid of it, there is a Restore Defaults button on the Colors and Fonts tab. You can also create and export your own themes as well. But if you do, be sure to test it with different file types including .txt and .xml. Also test the different streams like Verbose and Warning. And if you do come up with a cool theme, I hope you’ll share it with the PowerShell community.

4 thoughts on “Friday Fun: Theme Me Up!”

Comments are closed.