I am using the [URL=”http://jscolor.com/try.php”]jscolor
I am trying to use this script to convert the color
[CODE]function hex2rgb($hex) {
$hex = str_replace(“#”, “”, $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
$rgb = array($r, $g, $b);
//return implode(“,”, $rgb); // returns the rgb values separated by commas
return $rgb; // returns an array with the rgb values
}
This is my line for collecting the hex(same page as function)
$color = $_POST[“value”];
and this is my html
[code=html]<form action=”text-color.php” name=”genForm” method=”post”>
Color of Text <input class=”color” value=”000000″>
<br />
<input type=”submit” value=”Get Color” style=”height: 40px; width: 180px; font-size: 17px;” />
</form>
Since FPDF can only output RGB I need to be able change this
SetTextColor(int r [, int g, int b]) via the function, but can’t get it to work.
The PHP/PDF pages are set up correctly, as I am already outputting other information. This is the only part I can’t get to work.
Thanks