Last week I posted about the ability to theme the Powershell ISE script pane and provided a link to a few themes to play with. In that article I lamented about the lack of command line support for themes. Allow me to elaborate a little. You can certainly change any theme element from the command line but you can not do the following:
- Apply a theme to your ISE session from a file or from a previously saved ISE theme
- Import an xml theme to the ISE
- Export an ISE theme to an xml file
Worse yet, the color values stored in the theme xml files are ARGB based, not hex, which is what you need to apply a theme color to an ISE property from the command line. For this reason the scripts used to apply themes are completely different than the xml files used for the import/export process. How could Microsoft come so far, yet come up so short?! Frustrating to say the least!
Solution
- Batch import a collection of xml theme files
- Batch export all of the custom themes available in the ISE
- Choose a different custom theme from the command line
- Alter the overall color scheme of a theme without the need to tweak each parameter individually
- Cooler
- Warmer
- Greener
- Lighter
- Darker
ISEThemeCmdlets
Convert-HexToARGB()
#Converts Hex to ARGB values
$ARGB = Convert-HexToARGB #FF000022
Convert-ARGBToHex()
#Converts ARGB to Hex values
$Hex = Convert-ARGBToHex "255,0,0,233"
Get-CurrentISETheme()
#Gets current ISE theme. Hex colors are converted to ARGB and added back to the returned objects
$CurrentISETheme = Get-CurrentISETheme
Get-ISETheme()
#Gets an ISE them from either the ISE or xml file
$Theme = Get-FileName | Get-ISETheme
Get-ImportedISEThemes()
#Returns imported theme objects from the ISE
$Themes = Get-ImportedISEThemes
Set-ISETheme()
#Applies ISE theme to current session
Get-FileName | Set-ISETheme
Import-ISEThemeFile()
#Imports an ISE theme xml file into the ISE and applies it to the current session if ApplyTheme is passed
Get-ChildItem d:\sandbox -filter *.ps1xml -recurse | Import-ISEThemeFile -ApplyTheme
Export-ISEThemeFile()
#Exports an ISE theme to an xml file and saves it into the ISE if SaveToISE is passed
Export-ISEThemeFile -SaveToISE
Remove-ISETheme()
#Deletes an ISE theme from the ISE
Remove-ISETheme "Monokai"
Set-ISEThemeWarmth()
#Adjusts ISE Theme colors according to switch
Set-ISEThemeWarmth -Cooler
Select-ISETheme()
#Selects and applies an ISE theme using a selection form
Select-ISETheme
#Gets a file name using an OpenFileDialog.
Get-FileName | Set-ISETheme
Get-SaveFile()
#Gets a save file name using a SaveFileDialog.
$File = Get-SaveFile
More Color Themes
Last week I shared a collection of themes I found in various searches online. This week I’m happy to say the themes I’m sharing are all original and created using the ISE Color Theme Cmdlets!
Brownie

Aquatic

Nightvale

PaperRose

To batch import these new themes, extract them to your file system and run the following command:
gci "C:YourThemes" -Filter *.ps1xml | Select FullName | Import-ISEThemeFile
Here is a link to the new PowerShell Color Themes
Here is a link to the ISE Color Theme Cmdlets
One response to “Introducing the New ISE Color Theme Cmdlets!”
In default dark theme of ISE #region syntax as kinda blending in with the background. Couldn’t find a way to change #region color. Will this help me?