The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Color::Spectrum - Just another HTML color generator.

SYNOPSIS

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

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

DESCRIPTION

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

new

Constructor. No args.

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 );
hsi2rgb

Hue, saturation and intesity to red, green and blue.

rgb2hsi

Red, green and blue to hue, saturation and intesity.

About Muliple Color Spectrums

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],
 );

REQUIRES

Color::Library - Used to look up non hash value colors.

BUGS

Please report any bugs or feature requests to either

GITHUB

The Github project is https://github.com/jeffa/Color-Spectrum

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Color::Spectrum

You can also look for information at:

AUTHOR

Mark Mills

MAINTAINANCE

This package is maintained by Jeff Anderson, <jeffa at cpan.org>

COPYRIGHT

Copyright (c) 2015 Mark Mills.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.