public/Set/Set-ISEColor.ps1
function Set-ISEColor { <# .SYNOPSIS Adjusts the active ISE theme by shifting color tones in a specific direction. .DESCRIPTION The Set-ISEColor function modifies the currently applied PowerShell ISE theme by adjusting the color palette toward one of several directions: Cooler, Warmer, Greener, Darker, or Lighter. The adjustment is applied uniformly across all theme colors and immediately applied to the current session. .PARAMETER Cooler Adjusts the theme's color balance toward cooler hues (bluer tones). .PARAMETER Warmer Adjusts the theme's color balance toward warmer hues (red/orange tones). .PARAMETER Greener Adjusts the theme's color balance to emphasize green tones. .PARAMETER Darker Shifts all theme colors to darker variations. .PARAMETER Lighter Shifts all theme colors to lighter variations. .PARAMETER Degree The intensity of the adjustment (default is 20). Higher values yield more dramatic changes. .EXAMPLE Set-ISEColor -Cooler Makes the active theme slightly cooler in tone and applies it to the session. .EXAMPLE Set-ISEColor -Darker -Degree 30 Makes the theme 30 units darker across all colors. .NOTES Author: Jeff Pollock GitHub: https://github.com/phriendx/ISEColorTheme.cmdlets Website: https://pxlabs.info #> [CmdletBinding(DefaultParameterSetName = 'Cooler')] Param( [Parameter(Mandatory = $true, ParameterSetName = 'Cooler')] [switch]$Cooler, [Parameter(Mandatory = $true, ParameterSetName = 'Warmer')] [switch]$Warmer, [Parameter(Mandatory = $true, ParameterSetName = 'Greener')] [switch]$Greener, [Parameter(Mandatory = $true, ParameterSetName = 'Darker')] [switch]$Darker, [Parameter(Mandatory = $true, ParameterSetName = 'Lighter')] [switch]$Lighter, [int]$Degree = 20 ) begin { $XmlTheme = Get-CurrentISETheme If ($null -eq $script:ISEThemeState.CurrentISETheme) { $script:ISEThemeState.CurrentISETheme = $XmlTheme } $AdjustmentType = if ($Cooler) { "Cooler" } elseif ($Warmer) { "Warmer" } elseif ($Greener) { "Greener" } elseif ($Darker) { "Darker" } elseif ($Lighter) { "Lighter" } else { return } } process { $NewColors = Set-ISEColorAdjustment -ThemeData $XmlTheme -Adjustment $AdjustmentType -Degree $Degree } end { Set-ISETheme -ThemeObject $NewColors } } |