function pImage::toHTMLColor in Visitors 7
Same name and namespace in other branches
- 7.2 pChart/class/pImage.class.php \pImage::toHTMLColor()
File
- pChart/
class/ pImage.class.php, line 437
Class
Code
function toHTMLColor($R, $G, $B) {
$R = intval($R);
$G = intval($G);
$B = intval($B);
$R = dechex($R < 0 ? 0 : ($R > 255 ? 255 : $R));
$G = dechex($G < 0 ? 0 : ($G > 255 ? 255 : $G));
$B = dechex($B < 0 ? 0 : ($B > 255 ? 255 : $B));
$Color = "#" . (strlen($R) < 2 ? '0' : '') . $R;
$Color .= (strlen($G) < 2 ? '0' : '') . $G;
$Color .= (strlen($B) < 2 ? '0' : '') . $B;
return $Color;
}