Color::Spectrum(3pm)

Color::Spectrum3pm

Just another html color generator.

Usage

  # 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' );

Overview

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.

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:

•

RT: CPAN's request tracker (report bugs here) <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Color-Spectrum>

•

AnnoCPAN: Annotated CPAN documentation <http://annocpan.org/dist/Color-Spectrum>

•

CPAN Ratings <http://cpanratings.perl.org/d/Color-Spectrum>

•

Search CPAN <http://search.cpan.org/dist/Color-Spectrum/>

Maintainance

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

Releases

2 releases since Debian 12 (Bookworm); the text changed 1 time.

  1. 12
  2. 13

Bugs

Please report any bugs or feature requests to either

•

Email: "bug-color-spectrum at rt.cpan.org"

•

Web: <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Color-Spectrum>

Author

Mark Mills

From libcolor-spectrum-perl 1.16-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.