Thursday, 23 December 2010

Set-ISEThemeDefault.ps1

  1. <# 
  2. .SYNOPSIS 
  3.     This script resets the ISE to default ‘theme’. 
  4. .DESCRIPTION 
  5.     This script sets the key values in $PsIse.Options to their default 
  6.     options in $Psise.Options.DefaultOptions. This script is useful if you 
  7.     are playing with ISE options and don't quite get it right - just run this  
  8.     script to set things back to default.        
  9. .NOTES 
  10.     File Name  : Set-ISEThemeDefault.ps1 
  11.     Author     : Thomas Lee - tfl@psp.co.uk 
  12.     Requires   : PowerShell Version 2.0 (ISE only) 
  13. .LINK 
  14.     This script posted to: 
  15.         http://bit.ly/gJpu2W  
  16. .EXAMPLE 
  17.     This script when run just resets the theme to the default. To view, run from 
  18.     the ISE after changing options! 
  19. #> 
  20.  
  21. # Set Basic options 
  22. $psise.options.SelectedScriptPaneState = $psise.options.DefaultOptions.SelectedScriptPaneState 
  23. $psise.options.ShowToolBar             = $psise.options.DefaultOptions.ShowToolBar 
  24. $psise.options.FontSize                = $psise.options.DefaultOptions.FontSize 
  25. $psise.options.Fontname                = $psise.options.DefaultOptions.Fontname 
  26.  
  27. # set colouring 
  28. $psise.options.ErrorForegroundColor          = $psise.options.DefaultOptions.ErrorForegroundColor 
  29. $psise.options.ErrorBackgroundColor          = $psise.options.DefaultOptions.ErrorBackgroundColor 
  30. $psise.options.WarningForegroundColor        = $psise.options.DefaultOptions.WarningForegroundColor 
  31. $psise.options.WarningBackgroundColor        = $psise.options.DefaultOptions.WarningBackgroundColor 
  32. $psise.options.VerboseForegroundColor        = $psise.options.DefaultOptions.VerboseForegroundColor 
  33. $psise.options.VerboseBackgroundColor        = $psise.options.DefaultOptions.VerboseBackgroundColor 
  34. $psise.options.DebugBackgroundColor          = $psise.options.DefaultOptions.DebugBackgroundColor 
  35. $psise.options.DebugForegroundColor          = $psise.options.DefaultOptions.DebugForegroundColor 
  36. $psise.options.OutputPaneBackgroundColor     = $psise.options.DefaultOptions.OutputPaneBackgroundColor 
  37. $psise.options.OutputPaneTextBackgroundColor = $psise.options.DefaultOptions.OutputPaneTextBackgroundColor 
  38. $psise.options.OutputPaneForegroundColor     = $psise.options.DefaultOptions.OutPutPaneForegroundColor 
  39. $psise.options.CommandPaneBackgroundColor    = $psise.options.DefaultOptions.CommandPaneBackgroundColor 
  40. $psise.options.ScriptPaneBackgroundColor     = $psise.options.DefaultOptions.ScriptPaneBackgroundColor  
  41. $psise.options.ScriptPaneForegroundColor     = $psise.options.DefaultOptions.ScriptPaneForegroundColor  
  42.  
  43. # More options 
  44. $psise.options.ShowWarningForDuplicateFiles  = $psise.options.DefaultOptions.ShowWarningForDuplicateFiles   
  45. $psise.options.ShowWarningBeforeSavingOnRun  = $psise.options.DefaultOptions.ShowWarningBeforeSavingOnRun 
  46. $psise.options.UseLocalHelp                  = $psise.options.DefaultOpitons.UseLocalHelp 
  47. $psise.options.CommandPaneUp                 = $psise.options.DefaultOptions.CommandPaneUp 
  48.  
  49. # Reset Tokens Colors 
  50. $psISE.Options.TokenColors['Attribute']          = $psISE.Options.DefaultOptions.TokenColors['Attribute'] 
  51. $psISE.Options.TokenColors['Command']            = $psISE.Options.DefaultOptions.TokenColors['Command'] 
  52. $psISE.Options.TokenColors['CommandArgument']    = $psISE.Options.DefaultOPtions.TokenColors['CommandArgument'] 
  53. $psISE.Options.TokenColors['CommandParameter']   = $psISE.Options.DefaultOptions.TokenColors['CommandParameter'] 
  54. $psISE.Options.TokenColors['Comment']            = $psISE.Options.DefaultOptions.TokenColors['Comment'] 
  55. $psISE.Options.TokenColors['GroupEnd']           = $psISE.Options.DefaultOptions.TokenColors['GroupEnd'] 
  56. $psISE.Options.TokenColors['GroupStart']         = $psISE.Options.DefaultOptions.TokenColors['GroupStart'] 
  57. $psISE.Options.TokenColors['Keyword']            = $psISE.Options.DefaultOptions.TokenColors['Keyword'] 
  58. $psISE.Options.TokenColors['LineContinuation']   = $psISE.Options.DefaultOptions.TokenColors['LineContinuation'] 
  59. $psISE.Options.TokenColors['LoopLabel']          = $psISE.Options.DefaultOptions.TokenColors['LoopLabel'] 
  60. $psISE.Options.TokenColors['Member']             = $psISE.Options.DefaultOptions.TokenColors['Member'] 
  61. $psISE.Options.TokenColors['NewLine']            = $psISE.Options.DefaultOptions.TokenColors['NewLine'] 
  62. $psISE.Options.TokenColors['Number']             = $psISE.Options.DefaultOPtions.TokenColors['Number'] 
  63. $psISE.Options.TokenColors['Position']           = $psISE.Options.DefaultOptions.TokenColors['Position'] 
  64. $psISE.Options.TokenColors['StatementSeparator'] = $psISE.Options.DefaultOptions.TokenColors['StatementSeparator'] 
  65. $psISE.Options.TokenColors['String']             = $psISE.Options.DefaultOptions.TokenColors['String'] 
  66. $psISE.Options.TokenColors['Type']               = $psISE.Options.DefaultOptions.TokenColors['Type']  
  67. $psISE.Options.TokenColors['Unknown']            = $psISE.Options.DefaultOptions.TokenColors['Unknown'] 
  68. $psISE.Options.TokenColors['Variable']           = $psISE.Options.DefaultOptions.TokenColors['Variable'] 
  69.  
  70. # Done 

2 comments:

Jeffery Hicks said...

It would be exceedingly helpful if it was possible to download individual scripts.

Thomas Lee said...

I've not figured out an easy way to do that. You can download the whole library and get the individual scripts from there.

I'll work on this over the coming year.