You need to send the colors "black", "white", "grey", etc, through the form, and then process the imagecolorallocate once the form post back to the page.
PHP Code:
switch($_POST['color']) {
case 'white':
$color = imagecolorallocate($bg, 255, 255, 255);
break;
case 'grey':
$color = imagecolorallocate($bg, 128, 128, 128);
break;
case 'limegreen':
$color = imagecolorallocate($bg, 194, 247, 0);
break;
default:
$color = imagecolorallocate($bg, 0, 0, 0);
}
imagettftext($bg, $fontsize, 0, $x, $y, $color, $font, $text );
Of course, you can specify all of your colors, and then use a variable variable. I wouldn't trust the input from a post variable for that though.