Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Web-Safe Color Chart

by trantor (Chaplain)
on Oct 05, 2001 at 10:57 UTC ( [id://116927]=note: print w/replies, xml ) Need Help??


in reply to Web-Safe Color Chart

As far as I know, and as merlyn pointed out, a Web safe palette should consist of 6 * 6 * 6 = 216 colours only.

Besides this, an obviuos improvement in the readability of your code could be using foreach instead of while loops, e.g.:

my @nums = qw/00 33 66 99 CC FF/; foreach my $r (@nums) { foreach my $g (@nums) { foreach my $b (@nums) { # Do something with $r, $g and $b } } }

The usual way of representing this palette is either an 8 * 8 grid (using only the first 216 cells) or 6 tables, 6 * 6 each. The second approach is easier to program, the first more compact.

Speaking about CGI.pm, since you don't process input parameters, can't generate errors, always use the same Content-type, there are no big security concerns that should force you to use CGI instead of rolling your own. Nonetheless it is a good exercise and a good starting point for studying the module, which should be customary for more complex CGIs.

-- TMTOWTDI

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-24 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found