Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

to generate a set of well contrasted colors

by pg (Canon)
on Nov 07, 2003 at 00:22 UTC ( [id://305198]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub random_color {
        my ($r, $g, $b) = (int(rand(256)), int(rand(256)), int(rand(256)))
    +;
    ...
        my $color2 = sprintf("#%02x%02x%02x", ($r + 128) % 256, ($g + 128)
    + % 256, ($b + 128) % 256);
        return ($color1, $color2);
    }
    
  2. or download this
                    my ($c1, $c2) = random_color();
                    $msg .= $cgi->table({-border => 1, bgcolor => $c1, sty
    +le => "Color: $c2;"}, $cgi->Tr($table_data));
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://305198]
Approved by blokhead
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 15:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found