2010-08-12 Sergio Martin <sergio.martin@artica.es>
* include/functions_html.php: Added the function html2rgb for convert a color string from format #FFFFFF to RGB values git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3131 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
366e0138a5
commit
ca81d757cc
|
@ -1,3 +1,8 @@
|
|||
2010-08-12 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_html.php: Added the function html2rgb for
|
||||
convert a color string from format #FFFFFF to RGB values
|
||||
|
||||
2010-08-12 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* godmode/agentes/massive_operations.php: Added the massive operation
|
||||
|
|
|
@ -1183,4 +1183,30 @@ function print_label ($text, $id, $return = false, $options = false) {
|
|||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a html color like #FF00FF into the rgb values like (255,0,255).
|
||||
*
|
||||
* @param string color in format #FFFFFF, FFFFFF, #FFF or FFF
|
||||
*/
|
||||
function html2rgb($htmlcolor)
|
||||
{
|
||||
if ($htmlcolor[0] == '#') {
|
||||
$htmlcolor = substr($htmlcolor, 1);
|
||||
}
|
||||
|
||||
if (strlen($htmlcolor) == 6) {
|
||||
$r = hexdec($htmlcolor[0].$htmlcolor[1]);
|
||||
$g = hexdec($htmlcolor[2].$htmlcolor[3]);
|
||||
$b = hexdec($htmlcolor[4].$htmlcolor[5]);
|
||||
return array($r, $g, $b);
|
||||
} elseif (strlen($htmlcolor) == 3) {
|
||||
$r = hexdec($htmlcolor[0].$htmlcolor[0]);
|
||||
$g = hexdec($htmlcolor[1].$htmlcolor[1]);
|
||||
$b = hexdec($htmlcolor[2].$htmlcolor[2]);
|
||||
return array($r, $g, $b);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue