colors are set on these lines:
$color1 = imagecolorallocate($img, 0, 0, 0);
$color2 = imagecolorallocate($img, 0, 0, 0);
the 0,0,0 are Red, Green, Blue values. You might need an image editor (like photoshop) to know what colors are what. Or a reference like this might be helpful...