6 my @cols = qw/omg low med normal high ultra ultimate/;
11 my $fn = "effects-$col.cfg";
12 open my $fh, "<", "$fn"
17 next unless /^(\S+) (.*)$/;
18 $table{$1}{$col} = $2;
23 for my $row(keys %table)
28 for my $col(reverse @cols)
30 if(defined $last && $table{$row}{$col} == $last)
36 $last = $table{$row}{$col};
40 $sortkeys{$row} = \@toggles;
42 sub toggles_compare($$);
43 sub toggles_compare($$)
46 return 0 if !@$a and !@$b;
47 return -1 if !@$a and @$b;
48 return +1 if @$a and !@$b;
49 return -1 if $a->[0] < $b->[0];
50 return +1 if $a->[0] > $b->[0];
55 return toggles_compare \@a, \@b;
57 my @rows_sorted = sort { toggles_compare $sortkeys{$a}, $sortkeys{$b} or $a cmp $b } keys %table;
61 <title>Effects configs</title>
62 <h1>Effects configs</h1>
64 <tr><th width="40%">cvar</th>
70 <th width="@{[60 / @cols]}%">$col</th>
78 for my $row(@rows_sorted)
84 my $last_colspan = undef;
85 my $total_colspan = 0;
86 my $print_last = sub {
89 my $colorspan = ($last_colspan * 0.5 + $total_colspan) / @cols;
90 my $color = sprintf "#%02x%02x%02x",
91 # red-yellow-green transition
92 # FF0000 -> FFFF00 -> 00FF00
93 ($colorspan > 0.5) ? 255 * (2 - 2 * $colorspan) : 255,
94 ($colorspan < 0.5) ? 255 * (2 * $colorspan) : 255,
96 $total_colspan += $last_colspan;
98 <td colspan="$last_colspan" align="center" bgcolor="$color">$last</td>
104 my $v = $table{$row}{$col};
105 if(defined $last && $v == $last)