note 13896 added to function.pdf-setrgbcolor.php
| From: | n dot gaertner at gmx dot net | Date: | Mon, 09 Jul 2001 09:19:33 +0000 |
| Subject: | note 13896 added to function.pdf-setrgbcolor.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15116@lists.php.net to get a copy of this message | ||
<b>Use this code to convert HEX colors to RGB that you can use with pdf_setrgbcolor:</b>
<?
$color = "#FF00FF";
$string = str_replace("#","",$color);
$red = hexdec(substr($string,0,2)) / 255;
$green = hexdec(substr($string,2,2)) / 255;
$blue = hexdec(substr($string,4,2)) / 255;
pdf_rect($pdf, 110, 600, 20, 30);
pdf_setrgbcolor_fill($pdf, $red, $green, $blue);
pdf_fill($pdf);
?>
This gives you a pink rectangle!
http://www.php.net/manual/en/function.pdf-setrgbcolor.php