|
HTML::Rainbow - Put colour into your HTML |
HTML::Rainbow - Put colour into your HTML
This document describes version 0.05 of HTML::Rainbow, released 2007-09-27.
use HTML::Rainbow 'rainbow';
print rainbow('hello, world');
HTML::Rainbow will take plain text string (or array of strings)
and mark it up with <font> tags (or <span> tags
if you're feeling particularly orthodox), and produce text that
drifts endlessly from one colour to the next.
The intensity of the red, green and blue channels follow mutually prime sinusoidal periods.
This comes in handy when you have the burning desire to say
Perl is a language optimized for scanning arbitrary text files, extracting information from those text files, and printing reports based on that information. It's also a good language for many system management tasks. The language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal).
Win friends, and influence enemies, on your favourite HTML bulletin board.
HTML::Rainbow object. A set of key/value parameters
can be supplied to control the finer details of the object's
behaviour.
The colour-space of HTML is defined by a tuple of red, green and
blue components. Each component can vary between 0 and 255. Setting
all components to 0 produces black, and setting them all to 255
produces white. The parameters for new() allow you to control
the behaviour of the components, either individually or as a whole.
Each value may be specifed as a number from 0 to 255, or as a
percentage (such as 50%). Percentages are rounded to the nearest
integer, and values out of range are clipped to the nearest bound.
100% or
255 may result in black being produced. A similar warning concerning a
background colour of black applies here.
my $r = HTML::Rainbow->new(
red => 0,
green => 0,
min_blue => 10,
max_blue => 240,
);
... will result in a rainbow generator that moves through various shades of blue.
my $r = HTML::Rainbow->new(
min => 0,
max => '80%',
period_list => [qw[ 19 37 53 71 89 107 131 151 173 193 ]],
);
<span> element instead of the <font>
element for specifying the colour. The result uses 6 more characters
per marked up character.
The most specific parameter wins. If both, for example, a red
and a red_min parameter are found, the red parameter wins.
If a red_min and a min parameter is found, the red_min
parameter wins.
print $r->rainbow( 'somewhere over the rainbow, bluebirds fly' );
You can avoid using an intermediate variable by chaining the
rainbow method on from the new method:
print HTML::Rainbow->new(
max => 127,
min => 0,
period_list => [qw[ 11 29 47 71 97 113 149 173 ]],
)->rainbow( $text );
None.
eg directory
contains some examples to show how this may be done.
None known.
Please report all bugs at http://rt.cpan.org/NoAuth/Bugs.html
Make sure you include the output from the following two commands:
perl -MHTML::Rainbow -le 'print HTML::Rainbow::VERSION' perl -V
This module is dedicated to John Lang, someone I used to work with back in the early days of the web. I found him one day painstakingly writing HTML in a text editor and reviewing the results in Netscape. He was trying to do something like this, to post to a bulletin board, so I wrote some very ugly Perl to help him out. Ten years later, I finally got around to cleaning it up.
David Landgren, copyright (C) 2005-2007. All rights reserved.
If you (find a) use this module, I'd love to hear about it. If you want to be informed of updates, send me a note. You know my first name, you know my domain. Can you guess my e-mail address?
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|
HTML::Rainbow - Put colour into your HTML |