change
% for (1..$rows) { % for (1..$cols) { % last unless @colors; % my $color = shift(@colors); % } % } <%init> my %opt = @_; my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value}; my $unum = random_id(5); my $id = $opt{'id'} || $opt{'field'}.$unum; my @colors = ( '', #none/white 'FF6666', #red 'FF9966', #orange 'FFFF66', #yellow '66FF66', #green '66FFFF', #cyan? '6666FF', #blue 'CC66FF', #purple? FF66FF looks more like pink. ); my $rows = 2; my $cols = int(.5+scalar(@colors)/$rows);