- 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!
Where there is a problem, there is opportunity! After reviewing the situation and coming to the conclusion that all the pieces I needed were there, I decided to create the ISE Theme Cmdlets script module. This script module allows you to do all of the above and more from the command line.
Here are a few things you can do with these cmdlets:
- 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
This last bullet point or feature is a lot of fun! The Adjust-ISEColor cmdlet allows you to easily alter a theme by giving it the following commands:
This cmdlet also uses a "Degree" parameter to set the degree of change to make. By playing with this cmdlet I was able to generate all of the new themes attached below in a fraction of the time it would take with the default interface. Give it a try and share your work!
Here is the list of cmdlets with a short description and example.
Gets a file name using an OpenFileDialog.
Get-FileName | Set-ISETheme
Gets a save file name using a SaveFileDialog.
$File = Get-SaveFile
Converts Hex to ARGB values
$ARGB = Convert-HexToARGB #FF000022
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
Gets an ISE them from either the ISE or xml file
$Theme = Get-FileName | Get-ISETheme
Returns imported theme objects from the ISE
$Themes = Get-ImportedISEThemes
Applies ISE theme to current session
Get-FileName | Set-ISETheme
Imports an ISE theme xml file into the ISE and applies it to the current session if ApplyTheme is passed
Get-ChildItem d:\sandbox -Include *.ps1xml -recurse | Import-ISEThemeFile -ApplyTheme
Exports an ISE theme to an xml file and saves it into the ISE if SaveToISE is passed
Deletes an ISE theme from the ISE
Adjusts ISE Theme colors according to switch
Selects and applies an ISE theme using a selection form
More Color ThemesLast 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!
Here they are:
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