×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Algorithims with perl

Algorithims with perl

Algorithims with perl

(OP)
Hello, I have a problem that I would like to have solved. I was wondering if anyone knew of a way to write an algorithim in Perl that would generate all of the hex code colors possible. Something that would generate all of the colors between #000000 and #FFFFFF? If anyone knows that, I would be very appreciative. Thanks a lot.

-Vic

RE: Algorithims with perl

(OP)
Nevermind, I got it working. Here is the code if anyone wants it:



#!usr/bin/perl

@colors = qw(00 20 40 60 80 a0 c0 ff);

print "Content-type:text/html\n\n";

print "<html><head><title>Colors</title></head>\n";

print "<body>\n";

for ($i=0; $i<8; $i++) {
for ($j=0; $j<8; $j++) {
for ($k=0; $k<8; $k++) {

print "<font color=\#$colors[$i]$colors[$j]$colors[$k]>$colors[$i]$colors[$j]$colors[$k]</font><br>\n";

}
}
}

print "</body>\n";
print "</html>\n";


Or you can go to www.epicsoftware.com/vic/colors.cgi to see it in action.

Thanks.

-Vic

RE: Algorithims with perl

(OP)
Here is a more updated version if anyone wants to use it.


#!usr/bin/perl

@colors = qw(00 20 40 60 80 a0 c0 ff);

print "Content-type:text/html\n\n";

print "<html><head><title>Colors</title></head>\n";

print "<body>\n";


for ($i=0; $i<8; $i++) {
print "<table border=1 cellpadding=0 cellspacing=0><br>\n";
for ($j=0; $j<8; $j++) {

print "</tr><tr>\n";

for ($k=0; $k<8; $k++) {

print "<td bgcolor=\#$colors[$i]$colors[$j]$colors[$k] width=30 height=30>\n";
print "\ \;\n";
# print "<font color=\#$colors[7-$i]$colors[7-$j]$colors[7-$k]>$colors[$i]$colors[$j]$colors[$k]</font><br>\n";
print "</td>\n";


}
}
}

print "</table>\n";
print "</body>\n";
print "</html>\n";

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close