my $silver = "c0c0c0"; my ($light_silver, $dark_silver) = color_munge(25,$silver); sub color_munge { my @limits = (0, 255); my $off_set = shift; my $html_colour = shift; my @old = map hex, ($html_colour =~ /(..)(..)(..)/); my $brighter = join ('', map {$_ += $off_set; $_ = $limits[1] if $ +_ > $limits[1]; sprintf("%02X", $_); } @old); my $darker = join('', map {$_ -= 2 * $off_set; $_ = $limits[0] if +$_ < $limits[0]; sprintf("%02X", $_); } @old); return ($brighter,$darker); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Shading with HTML colors - color_munge
by merlyn (Sage) on Feb 27, 2001 at 22:06 UTC | |
by Vondikall (Initiate) on Mar 29, 2001 at 14:10 UTC | |
by merlyn (Sage) on Mar 29, 2001 at 19:34 UTC | |
by Anonymous Monk on Sep 18, 2012 at 08:20 UTC | |
|
Re: Shading with HTML colors - color_munge
by $code or die (Deacon) on Feb 27, 2001 at 22:48 UTC |