You would need to randomly generate the RGB color values on each loop:
foreach($return as $ret)
{
$r = rand(0,255);
$g = rand(0,255);
$b = rand(0,255);
$color = imagecolorallocate($img, $r, $g, $b);
#does it's image thing...
}
Otherwise, you're not changing colors, and they're coming out black because it's such a dark shade....