private/Convert/Convert-ARGBToHex.ps1

function Convert-ARGBToHex {
    <#
    .SYNOPSIS
        Converts an ARGB string to a hexadecimal color value.
 
    .DESCRIPTION
        The Convert-ARGBToHex function takes an ARGB string in the format "A,R,G,B" (e.g., "255,100,150,200")
        and converts it into a hex color code in the format "#AARRGGBB".
 
    .PARAMETER RGB_Val
        A comma-separated string of alpha, red, green, and blue channel values.
 
    .EXAMPLE
        Convert-ARGBToHex -RGB_Val "255,50,100,150"
 
        Returns: #FF326496
 
    .NOTES
        Author: Jeff Pollock
        GitHub: https://github.com/phriendx/ISEColorTheme.cmdlets
        Website: https://pxlabs.info
    #>


    [CmdletBinding()]
    Param(
        [Parameter(Mandatory)]
        [string]$RGB_Val
    )

    Process {
        $parts = $RGB_Val -split ',' | ForEach-Object { [int]$_ }
        if ($parts.Count -ne 4) {
            throw "Invalid ARGB value: $RGB_Val"
        }

        return ('#{0:X2}{1:X2}{2:X2}{3:X2}' -f $parts[0], $parts[1], $parts[2], $parts[3])
    }
}