Color::Spectrum - Generate spectrums of web colors


Color-Spectrum documentation  | view source Contained in the Color-Spectrum distribution.

Index


SYNOPSIS

Top

 # Procedural interface:
 use Color::Spectrum qw(generate);
 my @color = generate(10,'#000000','#FFFFFF');

 # OO interface:
 use Color::Spectrum;
 my $spectrum = Color::Spectrum->new();
 my @color = $spectrum->generate(10,'#000000','#FFFFFF');

DESCRIPTION

Top

From the author, Mark Mills: "This is a rewrite of a script I wrote [around 1999] to make spectrums of colors for web page table tags. It uses a real simple geometric conversion that gets the job done.

It can shade from dark to light, from saturated to dull, and around the spectrum all at the same time. It can go thru the spectrum in either direction."

METHODS

Top

generate

This method returns a list of size $elements which contains web colors starting from $start_color and ranging to $end_color.

 # Procedural interface:
 @list = generate($elements,$start_color,$end_color);

 # OO interface:
 @list = $spectrum->generate($elements,$start_color,$end_color);

About Muliple Color Spectrums

Top

Just call generate() more than once. If you want expand from one color to the next, and then back to the original color then simply reuse the returned array (minus the last element if you don't want the repeated color):

 my @color = $spectrum->generate(4,'#000000','#FFFFFF');

 print for @color, (reverse @color)[1..$#color];

If you want to expand from one color to the next, and then to yet another color, simply stack calls to generate() and take care to remove the repeated color each time:

 my @color = (
    $spectrum->generate(13,'#FF0000','#00FF00'),
    ($spectrum->generate(13,'#00FF00','#0000FF'))[1..12],
 );

SEE ALSO

Top

Color::Spectrum::Multi - If you do not feel comfortable working with array slices, then you can instead use this subclass to generate your multi colored spectrums.

BUGS

Top

If you have found a bug, typo, etc. please visit Best Practical Solution's CPAN bug tracker at http://rt.cpan.org:

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Color-Spectrum

or send mail to bug-Color-Spectrum@rt.cpan.org

AUTHOR

Top

Mark Mills

MAINTAINANCE

Top

This package is maintained by Jeffrey Hayes Anderson

COPYRIGHT

Top


Color-Spectrum documentation  | view source Contained in the Color-Spectrum distribution.