Right just knocked this up
#!/usr/bin/php -q
<?php
$fh=fopen('./colours.txt','r');
$data=fread($fh,filesize('./colours.dat'));
preg_match_all('/background-color:#([0-9A-Fa-f]{6});/',$data,$matches);
$query="INSERT INTO colours (hex_colour,dec_colour) VALUES ";
for($i=0;$i<count($matches[1]);$i++) {
$hex_colour=$matches[1][$i];
$dec_colour=hexdec(substr($hex_colour,0,2)).hexdec(substr($hex_colour,2,4)).hexdec(substr($hex_colour,4));
$query.=($i>0?',':'')."('$dec_colour','$hex_colour')";
}
echo($query."\n");
?>
For the file colours.dat I just copied and pasted the source for the colour table at w3 (near the bottom)
I've attached the dat file so you don't have to faf about finding the it in the source
HTH
Bubble