Color::Fade - Perl extension for fading text colors.
use Color::Fade qw(color_fade format_html); print format_html (color_fade ( 'Jackdaws love my big sphynx of quartz.', '#FF0000', '#00FF00', '#0000FF', ));
Color::Fade uses mathematical formulas to take an input string of virtually any length, and virtually any number of colors, and assign an individual color to each character to fade between each of the input colors.
In other words, it makes your sentences look really pretty. :)
Exports color_fade, format_html, format_css, format_ubb, and format_aim on demand.
Fade $string among the colors in @colors, where $string is a string of length greater than zero, and @colors is an array of colors in six byte hexadecimal format, with or without the leading octothorpe. @colors must have at least two elements.
$string
@colors
When called in array context, the method returns an array in which each element is of the format:
<color #xxxxxx>y
For each character, where xxxxxx is a hexadecimal color code and y is one character from the original string.
xxxxxx
y
When called in scalar context, this array is joined before being returned.
Note: It is perfectly possible to have more colors than you have characters in the original string. All that will happen is that each character of output will have a color from the original array, in the order the array was passed in, until there are no characters left.
Formats @codes in standard HTML, where @codes is an array returned from color_fade. Do not pass a scalar into this array; it won't run the way you expect it to.
@codes
color_fade
Outputs a scalar of HTML source code in the format:
<font color="#xxxxxx">y</font>
For those of us who try to stay on the W3C's good side and be HTML 4.01 compliant, this method formats it in code that is HTML 4.01 compliant!
<span style="color: #xxxxxx">y</span>
Since so many of us programmers are regular members of message boards, a function was included to format it for UBB code.
Outputs a scalar of UBB code in the format:
[color=#xxxxxx]y[/color]
This special routine is to format the code for use on AOL Instant Messenger. It is the same as format_html, but it lacks any of the </font> tags (as these tend to close every open font tag, not just the most recently opened one).
Outputs a scalar in the format:
<font color="#xxxxxx">y
Cuvou's Text Fader, an online implementation of this module. http://www.cuvou.com/wizards/fader.cgi
Casey Kirsle, <casey at cuvou.net>
Copyright (C) 2007 by Casey Kirsle
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install Color::Fade, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Color::Fade
CPAN shell
perl -MCPAN -e shell install Color::Fade
For more information on module installation, please visit the detailed CPAN module installation guide.