How to change the color of the PowerShell ISE editor using command?


To change the color of the ISE Editor, we need to use $psISE cmdlet which is only available for the ISE editor.

Now in the ISE editor, we have many colors some are visible (ScriptPane color, Console Color, etc) and some appear while executing a script (Error, Warning, Verbose). These properties are as below.

ErrorForegroundColor           : #FFFF9494
ErrorBackgroundColor           : #00FFFFFF
WarningForegroundColor         : #FFFF8C00
WarningBackgroundColor         : #00FFFFFF
VerboseForegroundColor         : #FF00FFFF
VerboseBackgroundColor         : #00FFFFFF
DebugForegroundColor           : #FF00FFFF
DebugBackgroundColor           : #00FFFFFF
ConsolePaneBackgroundColor     : #FF000080
ConsolePaneTextBackgroundColor : #FF012456
ConsolePaneForegroundColor     : #FFF5F5F5
ScriptPaneBackgroundColor      : #FFFFFFFF
ScriptPaneForegroundColor      : #FF000000

Lef side is the particular color attribute and the right side is the color name in the code. To set the Console Background color, we can use the following command, and immediately console background color will change to red.

$psISE.Options.ConsolePaneBackgroundColor = 'Red'

Output

Similarly, to change the script pane background color,

$psISE.Options.ScriptPaneBackgroundColor = 'Black'

Output

Similarly, you can set debug mode color, error, warning, verbose color, etc.

If you have messed color in ISE and want to restore back then don’t worry, there is an option DefaultOptions in the $PSISE cmdlet, Options property and there you can find the original color.

$psISE.Options.DefaultOptions

We can restore the colors using the below command.

$psISE.Options.ScriptPaneBackgroundColor = '#FFFFFFFF'

Updated on: 18-Jan-2021

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements