function pImage::toHTMLColor

5.x pImage.class.php pImage::toHTMLColor($R, $G, $B)

File

inc/pchart/pchart/class/pImage.class.php, line 437

Class

pImage

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);
}