PERL   66

html colors

Guest on 9th June 2022 01:25:39 AM

  1. #!/usr/bin/perl
  2. # Script: vegetables1.pl
  3. use CGI::Pretty ':standard';
  4. print header,
  5.   start_html('colors'),
  6.   h1('HTML Color Table'),
  7.  
  8.   @values = qw(00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF);
  9.  
  10.   print ("<table border=1 cellpadding=2>\n");
  11.   for ($B = 0; $B <= 15; $B++) {
  12.     for ($G = 0; $G <= 15; $G++) {
  13.       print ("<tr>\n");
  14.       for ($R = 0; $R <= 15; $R++) {
  15.         $color = "$values[$R]$values[$G]$values[$B]";
  16.         print ("<td bgcolor=\"#$color\">");
  17.         print ("#$color");
  18.         print ("</td>\n");
  19.       }
  20.     }
  21.     print ("</tr>\n");
  22.   }
  23.   print ("</table>\n");
  24.  
  25.   end_html;

Raw Paste


Login or Register to edit or fork this paste. It's free.