in reply to Re: Re: Hex color degrader
in thread Hex color degrader
sub add_to_hexrgb { my @rgb = map hex, unpack "A2"x3, $_[0]; my $max = (sort {$a <=> $b} @rgb)[-1]; my $smax = $max + $_[1]; return $smax < 0 ? "000000" : $smax > 255 ? "FFFFFF" : do { my $fact = ($max + $sumd) / $max; sprintf "%02X"x3, map { int($_ * $fact) } @rgb }; }
Makeshifts last the longest.
|
|---|