This alias takes two color sets and equally blends them. The alias accepts either r,g,b or their respective values.
To use:
$RGBMixer(r1, g1, b1, r2, g2, b2)
mixes rgb color sets into a single rgb value
$RGBMixer(color1, color2)
Blends the two rgb color values into a single rgb value
alias RGBMixer {
if ($0 != 2 && $0 != 6) || (!$regex($replace($1-,$chr(32),),/^\d+$/)) {
return -1
}
if ($0 == 2) {
tokenize 44 $rgb($1) $+ , $+ $rgb($2)
}
var %r = $iif($round($calc(($1 + $4) / 2), 0) > 255, 255, $iif($v1 < 0, 0, $v1))
var %g = $iif($round($calc(($2 + $5) / 2), 0) > 255, 255, $iif($v1 < 0, 0, $v1))
var %b = $iif($round($calc(($3 + $6) / 2), 0) > 255, 255, $iif($v1 < 0, 0, $v1))
return $rgb(%r, %g, %b)
}
Oops, yea. thanx. the subtraction was from another alias I was working on that allowed ratio blending >.>