Public/Add/Add-ISEThemeMenu.ps1

function Add-ISEThemeMenu {
<#
    .Synopsis
     This is a function that adds more tooling to the ISE for switching themes
  .DESCRIPTION
     This is a function that adds more tooling to the ISE for switching themes making it easier to have a change when required
  .EXAMPLE
     Add-ISEThemeMenu
#>


[cmdletbinding()]
Param()


    Process {
        $parentAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add('ISE Color Themes',$null,$null)       

        $Functions = @()

        $OutputObj  = New-Object -Type PSObject
        $OutputObj | Add-Member -MemberType NoteProperty -Name FunctionName –Value 'Theme Selector'
        $OutputObj | Add-Member -MemberType NoteProperty -Name 'Scriptblock' –Value 'Select-ISETheme' #ShortcutKey "ALT+SHIFT+W"
        $OutputObj | Add-Member -MemberType NoteProperty -Name ShortcutKey –Value 'CTRL+ALT+SHIFT+T'
        $Functions += $OutputObj 

        $Options = 'darker|lighter|warmer|cooler|greener'
        $OptionArray = $Options.Split('|')

        $ShortcutKey = 0

        $optionArray | ForEach-Object {
            $OutputObj  = New-Object -Type PSObject
            $OutputObj | Add-Member -MemberType NoteProperty -Name FunctionName –Value "Set $_"
            $OutputObj | Add-Member -MemberType NoteProperty -Name 'Scriptblock' –Value "Set-ISEColor -$_" #ShortcutKey "ALT+SHIFT+W"
            $OutputObj | Add-Member -MemberType NoteProperty -Name ShortcutKey –Value "ALT+SHIFT+$ShortcutKey"
            $Functions += $OutputObj 

            $ShortcutKey += 1
        }

        $Functions | Foreach-Object {
            $functionname = $_.FunctionName.ToString()
            $sb=$executioncontext.InvokeCommand.NewScriptBlock($_.Scriptblock)
            $parentAdded.Submenus.Add($functionname,$sb,$_.ShortcutKey) | out-null
        }

        If (!(Test-Path 'HKCU:\Software\Microsoft\PowerShell\3\Hosts\PowerShellISE\ColorThemes')) {
            New-Item -Path 'HKCU:\Software\Microsoft\PowerShell\3\Hosts\PowerShellISE' -Name ColorThemes –Force | out-null
        }

        $ThemeMenu = $ParentAdded.SubMenus.Add('Imported Themes',$null,$null)
        $Themes = @()
        $ImportedThemes = Get-ImportedISETheme        

        $ImportedThemes | ForEach-Object {           
            $OutputObj  = New-Object -Type PSObject
            $OutputObj | Add-Member -MemberType NoteProperty -Name 'FunctionName' –Value $_.ThemeName
            $OutputObj | Add-Member -MemberType NoteProperty -Name 'Scriptblock' –Value "Set-ISETheme -ThemeName '$($_.ThemeName)'"
            $Themes += $OutputObj           
        }

        $OutputObj  = New-Object -Type PSObject
        $OutputObj | Add-Member -MemberType NoteProperty -Name 'FunctionName' –Value 'Import CSE Themes'
        $OutputObj | Add-Member -MemberType NoteProperty -Name 'Scriptblock' –Value 'Import-GroupISETheme'
        $Themes += $OutputObj

        $Themes | Foreach-Object {
            $functionname = $_.FunctionName.ToString()
            $sb=$executioncontext.InvokeCommand.NewScriptBlock($_.Scriptblock)
            $ThemeMenu.Submenus.Add($functionname,$sb,$null) | out-null
        }
    }

}