initial push

This commit is contained in:
CeeWeasel
2024-04-14 14:08:56 -04:00
commit 53bf393d14
1111 changed files with 71730 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
function Get-ColorXY ([int]$Red=0, [int]$Green=0, [int]$Blue=0, [int]$Decimals=4)
{
$redC = ($red / 255)
$greenC = ($green / 255)
$blueC = ($blue / 255)
if ($redC -gt 0.04045) {
$redN = [math]::pow(($redC + .055) / (1 + .055),2.4)
} else {
$redN = $redC / 12.92
}
if ($greenC -gt 0.04045) {
$greenN = [math]::pow(($greenC + .055) / (1 + .055),2.4)
} else {
$greenN = $greenC / 12.92
}
if ($blueC -gt 0.04045) {
$blueN = [math]::pow(($blueC + .055) / (1 + .055),2.4)
} else {
$blueN = $blueC / 12.92
}
$X = $redN * 0.664511 + $greenN * 0.154324 + $blueN * 0.162028;
$Y = $redN * 0.283881 + $greenN * 0.668433 + $blueN * 0.047685;
$Z = $redN * 0.000088 + $greenN * 0.072310 + $blueN * 0.986039;
if (($X+$Y+$Z) -gt 0) {
$x2 = $X / ($X + $Y + $Z)
$y2 = $Y / ($X + $Y + $Z)
} else {
$x2 = 0
$y2 = 0
}
[pscustomobject]@{
color_x = [math]::Round($x2,$Decimals)
color_y = [math]::Round($y2,$Decimals)
}
#$x2, $y2
}