Color::Spectrum(3pm)
π Color::Spectrum β just another HTML color generator π
okay so bestie, welcome to Color::Spectrum, straight out of the User Contributed Perl Documentation corner of the Perl universe. she's a color spectrum generator and she ate, no cap. πβ¨
πΈ NAME πΈ
Color::Spectrum β just another HTML color generator. and honestly? the name is not lying to you. π
β¨ SYNOPSIS β¨
two ways in, bestie. pick your fighter:
# 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 π¦
okay so, direct from the author himself, 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."
the way that he's been doing color math since 1999 and it STILL gets the job done? main character energy fr fr. π
π METHODS π
new
Constructor. No args. that's it, that's the whole thing. she takes nothing and gives you everything. π«Ά
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. (the round trip, iconic, obsessed.) π₯
π About Muliple Color Spectrums π
want more than one spectrum? just call generate() more than once, bestie. not me giving you the cheat codes. π
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 how she slices off the repeat? that's the [1..12] doing the lord's work. β
π§ REQUIRES π§
- Color::Library β Used to look up non hash value colors.
π BUGS π
got beef with a bug? got a feature request? 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>
they literally want to hear from you, don't be shy. π
π GITHUB π
The Github project is <https://github.com/jeffa/Color-Spectrum>
go snoop, go star, go read the source. iykyk. β¨
π 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/>
π AUTHOR π
Mark Mills
π MAINTAINANCE π
This package is maintained by Jeff Anderson, "jeffa at cpan.org"
π COPYRIGHT π
Copyright 2024 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>
okay bestie, legal arc incoming, but it's important so read it. π
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. π
and that's the whole page, bestie!! this one shipped as part of perl v5.38.2, dated 2024-02-04, and it lives at Color::Spectrum(3pm). go make some pretty colors, you absolute icon. πβ¨π¦πΈππ«Ά
π¦ where this page comes from
- debian trixie: libcolor-spectrum-perl 1.16-1 Β· Artistic-2.0
- ubuntu noble: libcolor-spectrum-perl 1.16-1 Β· Artistic-2.0
- ubuntu resolute: libcolor-spectrum-perl 1.16-1 Β· Artistic-2.0
- ubuntu stonking: libcolor-spectrum-perl 1.16-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms