Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Random Color Generator

by OfficeLinebacker (Chaplain)
on Sep 14, 2006 at 15:55 UTC ( #572946=note: print w/ replies, xml ) Need Help??


in reply to Random Color Generator

Greetings, esteemed monks!

Pretty sweet. For generating just one random color, I used

my @ca=('0','3','6','9','C','E'); my @bgc=('','',''); foreach my $c (@bgc){ $r=int(rand(6)); $c=$ca[$r].$ca[$r]; } my $bgc=join("",@bgc);

_________________________________________________________________________________

I like computer programming because it's like Legos for the mind.


Comment on Re: Random Color Generator
Download Code
Re^2: Random Color Generator
by shibu_pu (Acolyte) on Jun 06, 2013 at 11:17 UTC
    my ($red, $green, $blue) = (int(rand(255)), int(rand(255)), int(rand(2 +55))); print qq{<div style="background-color: rgb($red, $green, $blue);"></di +v>};
      Or, if you do not want to repeat yourself:
      my ($red, $green, $blue) = map int rand 255, 1 .. 3;
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
        A golfer, I see.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://572946]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2014-10-24 18:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (134 votes), past polls