Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

Friday Fun: Theme Me Up!

Posted on November 15, 2013

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.

Manage and Report Active Directory, Exchange and Microsoft 365 with
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:

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.


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

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

  1. jvierra says:
    November 15, 2013 at 11:36 am

    Well shades of “VI”.

  2. Mustafa Çağrı ÇALIŞKAN says:
    November 16, 2013 at 9:01 pm

    thank you

  3. Joe Rodriguez (@joerodr) says:
    March 14, 2014 at 3:34 pm

    Cool! But what if I want to go back?

    1. Jeffery Hicks says:
      March 14, 2014 at 4:14 pm

      Under ISE options you should see a button for restoring defaults.

Comments are closed.

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d