3 # Convert color value from hexadecial to floating point and vice versa.
6 # ./color-convert.pl [RRGGBB | R.R G.G B.B]
15 printf("%.2g %.2g %.2g\n",
16 hex(substr($ARGV[0], 0, 2)) / 255,
17 hex(substr($ARGV[0], 2, 2)) / 255,
18 hex(substr($ARGV[0], 4, 2)) / 255);
23 printf("%02x%02x%02x\n",
24 int($ARGV[0]*255 + 0.5),
25 int($ARGV[1]*255 + 0.5),
26 int($ARGV[2]*255 + 0.5));