]> icculus.org git repositories - divverent/nexuiz.git/blob - data/gfx/colormap_palette.pl
add perl script to make the palette
[divverent/nexuiz.git] / data / gfx / colormap_palette.pl
1 use strict;
2 use warnings;
3
4 my @colors = (
5         'cccccc',
6         '996600',
7         '00ff80',
8         '00ff00',
9         'ff0000',
10         '00a8ff', # was: 0080ff, green increased
11         '00ffff',
12         '80ff00',
13         '8000ff',
14         'ff00ff',
15         'ff0080',
16         '999999',
17         'ffff00',
18         '0050ff', # was: 0000ff, green increased so the color is perceptively just as bright as red (for teamplay)
19         'ff8000',
20         '000000'
21 );
22
23 my $value_min = 0x0F;
24 my $value_max = 0xFF;
25
26 my $i = 0;
27 for(@colors)
28 {
29         /^(..)(..)(..)$/ or die "invalid color spec: $_";
30         my $r = hex $1;
31         my $g = hex $2;
32         my $b = hex $3;
33         printf "%c%c%c", map { int(0.5 + $value_min + ($_ * 1.0 / 0xFF) * ($value_max - $value_min)) } $r, $g, $b;
34         printf STDERR "\t\tcase %2d: return '%f %f %f';\n", $i, $r / 0xFF, $g / 0xFF, $b / 0xFF;
35         ++$i;
36 }