Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Web-Safe Color Chart

by trantor (Chaplain)
on Oct 05, 2001 at 10:57 UTC ( #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, 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.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://116927]
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 2023-12-10 20:05 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (41 votes). Check out past polls.