Translate, lighten, darken, invert named colors.
PhilipRBrenan@yahoo.com, 2004, Perl License
Example t/color.t
#_ Color _______________________________________________________________ # Test colors # philiprbrenan@yahoo.com, 2004, Perl License #_______________________________________________________________________ use Math::Zap::Color; use Test::Simple tests=>20; ok(color('dark red')->normal eq '#8b0000'); ok(color('dark red')->light eq '#c58080'); ok(color('red')->normal eq '#ff0000'); ok(color('red')->light eq '#ff8080'); ok(color('red')->dark eq '#7f0000'); ok(color('red')->invert eq '#00ffff'); use Math::Zap::Color color=>'c', invert=>-i; my $c = c -red; ok("$c" eq '#ff0000'); ok(i(-red) eq '#00ffff'); ok(c('dark red')->normal eq '#8b0000'); ok(c('dark red')->light eq '#c58080'); ok($c->normal eq '#ff0000'); ok($c->light eq '#ff8080'); ok($c->dark eq '#7f0000'); ok($c->invert eq '#00ffff'); ok(c(-green) eq '#00ff00'); ok(c('ReD') eq '#ff0000'); ok(c(-red) eq '#ff0000'); ok(c('#ff0000') eq '#ff0000'); ok(c('ff0000') eq '#ff0000'); ok(c('255,0,0') eq '#ff0000');
Simplifies the management of colors by allowing X11 color names to be used; provides methods for manipulating the colors.
A color may be constructed from a reference to an existing color, or from a string containing: a color name (quoted or preceeded by -, case insensitive), or 3 hexadecimal numbers optionally preceeded by #, or 3 decimal numbers separated by commas: these number representing the rgb color values in the range 0..255. Thus:
'ReD' -red 'ff0000' '255,0,0'
Check that an anonymous reference is a reference to a color and confess if it is not.
Same as "check" but return the result to the caller.
Normal value of the color
Lighter shade of the color
Darker shade of the color
Inversion of the color
The names of the colors and their matching RGB values.
Stringification returns the normal value of the color
Export "color", "light", "dark", "invert"
philiprbrenan@yahoo.com
philiprbrenan@yahoo.com, 2004
Perl License.
To install Math::Zap::Draw, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Zap::Draw
CPAN shell
perl -MCPAN -e shell install Math::Zap::Draw
For more information on module installation, please visit the detailed CPAN module installation guide.