private/Set/Set-ISEColorAdjustment.ps1

function Set-ISEColorAdjustment {
    <#
    .SYNOPSIS
        Applies a tone adjustment to an ISE color theme object.
 
    .DESCRIPTION
        The Set-ISEColorAdjustment function processes theme color data and shifts the RGB values based on the
        specified adjustment type—Cooler, Warmer, Greener, Darker, or Lighter. The function returns a new array
        of color objects with updated ARGB and hexadecimal values. Font-related metadata (the "Other" class)
        is preserved but not modified.
 
    .PARAMETER ThemeData
        An array of color theme objects, typically retrieved from Get-ISETheme or Get-CurrentISETheme.
 
    .PARAMETER Adjustment
        The type of tonal shift to apply to the color set. Options include: Cooler, Warmer, Greener, Darker, Lighter.
 
    .PARAMETER Degree
        Controls the intensity of the adjustment (default is 20). Higher values amplify the color shift.
 
    .EXAMPLE
        $adjusted = Set-ISEColorAdjustment -ThemeData $theme -Adjustment 'Cooler'
 
        Applies a cooler color bias to the theme data and returns the adjusted set.
 
    .EXAMPLE
        $adjusted = Set-ISEColorAdjustment -ThemeData $theme -Adjustment 'Darker' -Degree 40
 
        Darkens the entire theme by 40 units and returns the modified objects.
 
    .NOTES
        Author: Jeff Pollock
        GitHub: https://github.com/phriendx/ISEColorTheme.cmdlets
        Website: https://pxlabs.info
    #>


    [CmdletBinding()]
    param (
        [Parameter(Mandatory)]
        [array]$ThemeData,

        [Parameter(Mandatory)]
        [ValidateSet("Cooler", "Warmer", "Greener", "Darker", "Lighter")]
        [string]$Adjustment,

        [int]$Degree = 20
    )

    $Subtract = $Degree / 2
    $AdjustedColors = @()

    foreach ($Attribute in $ThemeData) {
        if ($Attribute.Class -eq 'Other') { continue }

        $var_A = $Attribute.A
        $var_R = $Attribute.R
        $var_G = $Attribute.G
        $var_B = $Attribute.B

        switch ($Adjustment) {
            "Cooler" {
                $var_R = [math]::Max(0, $var_R - $Subtract)
                $var_B = [math]::Min(255, $var_B + $Degree)
            }
            "Warmer" {
                $var_R = [math]::Min(255, $var_R + $Degree)
                $var_B = [math]::Max(0, $var_B - $Subtract)
            }
            "Greener" {
                $var_R = [math]::Max(0, $var_R - ($Subtract / 2))
                $var_G = [math]::Min(255, $var_G + $Degree)
                $var_B = [math]::Max(0, $var_B - ($Subtract / 2))
            }
            "Darker" {
                $var_R = [math]::Max(0, $var_R - $Degree)
                $var_G = [math]::Max(0, $var_G - $Degree)
                $var_B = [math]::Max(0, $var_B - $Degree)
            }
            "Lighter" {
                $var_R = [math]::Min(255, $var_R + $Degree)
                $var_G = [math]::Min(255, $var_G + $Degree)
                $var_B = [math]::Min(255, $var_B + $Degree)
            }
        }

        $Hex = Convert-ARGBToHex "$var_A,$var_R,$var_G,$var_B"

        $colorObj = [PSCustomObject]@{
            Class     = $Attribute.Class
            Attribute = $Attribute.Attribute
            A         = $var_A
            R         = $var_R
            G         = $var_G
            B         = $var_B
            Hex       = $Hex
        }

        $AdjustedColors += $colorObj
    }

    return $AdjustedColors
}