When 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.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
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.
# Set font name and size $psISE.Options.FontName = 'Courier New' $psISE.Options.FontSize = 16 # Set colors for command pane $psISE.Options.ConsolePaneBackgroundColor = '#FF000000' $psISE.Options.ConsolePaneTextBackgroundColor = '#FF000000' # Set colors for script pane $psise.options.ScriptPaneBackgroundColor ='#FF000000'
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.
#modified for powerShell 3.0 <# .SYNOPSIS This script sets an ISE Theme to similar to the old VIM editor. .DESCRIPTION This script sets the key values in $PsIse.Options to values consistent with the VIM editor, beloved by many, particularly on the Powershell product team. This script is based on Davis Mohundro's blog post ( http://bit.ly/iib5IM), updated for RTM of PowerShell V2.0. See also .NOTES File Name : Set-ISEThemeVIM.ps1 Author : Thomas Lee - [email protected] Requires : PowerShell Version 2.0 (ISE only) .LINK This script posted to: http://www.pshscripts.blogspot.com .EXAMPLE This script when run resets colours on key panes, including colourising tokens in the script pane. Try it and see it... #> # PowerShell ISE version of the VIM blackboard theme at # http://www.vim.org/scripts/script.php?script_id=2280 # Set font name and size $psISE.Options.FontName = 'Courier New' $psISE.Options.FontSize = 16 # Set colours for command pane $psISE.Options.ConsolePaneBackgroundColor = '#FF000000' $psISE.Options.ConsolePaneTextBackgroundColor = '#FF000000' # Set colours for script pane $psise.options.ScriptPaneBackgroundColor ='#FF000000' # Set colours for tokens in Script Pane $psISE.Options.TokenColors['Command'] = '#FFFFFF60' $psISE.Options.TokenColors['Unknown'] = '#FFFFFFFF' $psISE.Options.TokenColors['Member'] = '#FFFFFFFF' $psISE.Options.TokenColors['Position'] = '#FFFFFFFF' $psISE.Options.TokenColors['GroupEnd'] = '#FFFFFFFF' $psISE.Options.TokenColors['GroupStart'] = '#FFFFFFFF' $psISE.Options.TokenColors['LineContinuation'] = '#FFFFFFFF' $psISE.Options.TokenColors['NewLine'] = '#FFFFFFFF' $psISE.Options.TokenColors['StatementSeparator'] = '#FFFFFFFF' $psISE.Options.TokenColors['Comment'] = '#FFAEAEAE' $psISE.Options.TokenColors['String'] = '#FF00D42D' $psISE.Options.TokenColors['Keyword'] = '#FFFFDE00' $psISE.Options.TokenColors['Attribute'] = '#FF84A7C1' $psISE.Options.TokenColors['Type'] = '#FF84A7C1' $psISE.Options.TokenColors['Variable'] = '#FF00D42D' $psISE.Options.TokenColors['CommandParameter'] = '#FFFFDE00' $psISE.Options.TokenColors['CommandArgument'] = '#FFFFFFFF' $psISE.Options.TokenColors['Number'] = '#FF98FE1E' <# Set the script foreground color to white so text files display properly. Set Verbose ForegroundColor to Yellow Set Debug Foreground color to light purple -JDH #> $psise.options.ScriptPaneForegroundColor= 'White' $psise.Options.VerboseForegroundColor = '#FFFFFF00' $psise.Options.DebugForegroundColor ='#FFE500E5' $psise.Options.XmlTokenColors['Comment'] = '#FF00FF00' $psise.Options.XmlTokenColors['CommentDelimiter'] = '#FF00FF00' $psise.Options.XmlTokenColors['ElementName']= '#FFFFFF00' $psise.Options.XmlTokenColors['MarkupExtension']= '#FFFF8C00' $psise.Options.XmlTokenColors['Attribute']= '#FFFF0000' $psise.Options.XmlTokenColors['Quote']= '#FFE5E500' $psise.Options.XmlTokenColors['QuotedString']= '#FFFFFFFF' $psise.Options.XmlTokenColors['Tag']= '#FF00FFFF' $psise.Options.XmlTokenColors['Text']= '#FFFFFFFF' $psise.Options.XmlTokenColors['CharacterData']= '#FFD4D4D4'
If you run the script in the ISE, it will turn into this:
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.
Well shades of “VI”.
thank you
Cool! But what if I want to go back?
Under ISE options you should see a button for restoring defaults.