class chart{
var $type = "SnapWithRotation";
var $idCounter = 0;
var $params = array (
'largeur' => 516,
'hauteur' => 346,
'rayon' => '115',
'rayon-supplementaire' => '25',
'rayon-du-texte' => '12',
'angle-de-depart' => '0',
'duree-animation' => '500',
'taille-des-labels' => '10',
'epaisseur-des-traits' => '0.8',
'nombre-de-cercles-concentriques' => '10',
'couleur-et-opacite-des-disques-concentriques' => 'rgba(255, 255, 255, 0.13)',
'couleur-des-cercles-concentriques' => '#ececec',
'couleur-des-lignes-radiantes' => '#AAAAAA',
'couleur-des-points' => '#AAAAAA',
'taille-des-points' => '2',
'largeur-indicateur-de-points' => '30',
'hauteur-indicateur-de-points' => '20',
'couleur-et-opacite-indicateur-de-points' => 'rgba(80,80,80,0.65)',
'arrondi-indicateur-de-points' => '5',
'taille-du-texte-indicateur-de-points' => '10',
'couleur-du-texte-indicateur-de-points' => 'white',
'couleur-de-la-comparaison' => 'none',
'couleur-du-bord-de-la-comparaison' => 'lime',
'epaisseur-du-bord-de-la-comparaison' => 0.8,
'oversampling-de-limage' => 6,
'image-output' => NULL,
'decalage-x-img' => 0,
'decalage-y-img' => 0,
);//ces éléments sont mis-à-jour avec les élément de la page #18 (radar) dans le constructeur du root
function getId(){
$this->idCounter++;
return "chartId".$this->idCounter;
}
function donut($value = 50, $radius = '',$stroke = '',$style='',$color='',$speed='',$margin='',$circle=''){
$texte = $value.'%';
$value = max(0,min(99.9,$value));
foreach(array('radius'=>30,'stroke'=>7,'speed'=>1000) as $param=>$val)
if($$param == '')
$$param = $val;
$angleInRadians = (-1) * $value * pi() / 50;
$center = $stroke/2+$radius;
$x = $center - ($radius * cos($angleInRadians));
$y = $center - ($radius * sin($angleInRadians));
$id = $this->getId();
$strokeDasharray = 300;
$sortie = "";
//version SVG
return ''.($value > 0?'':'').''.$texte.'';
}
function radar($points,$width='',$height='',$axes){
$width = ($width==''?$this->params['largeur']:$width);
$height = ($height==''?$this->params['hauteur']:$height);
$radius = $this->params['rayon'];
$more_radius = $this->params['rayon-supplementaire'];
$startangle = pi()*(0.5 + $this->params['angle-de-depart']/180);
$speedfactor = $this->params['duree-animation']/100;
//$points = array_reverse($points);
return $this->{'radar'.$this->type}($points,$width,$height,$radius,$more_radius,$startangle,$speedfactor,$axes);
}
function radarImg($points,$width,$height,$radius,$more_radius,$startangle,$speedfactor,$axes){
$rescale = 3;
$width_fin = $width;
$height_fin = $height;
$width = (int)$width;
$height = (int)$height;
foreach(array('width','height','radius','more_radius') as $var)
$$var *= $rescale;
foreach(array('taille-des-points','epaisseur-des-traits','taille-des-labels','rayon-du-texte','taille-du-texte-indicateur-de-points') as $var)
$this->params[$var] *= $rescale;
$this->params['taille-des-labels'] *= 0.7; //compensation de la taille du texte pour l'égaler au svg
$centerx = $width/2 + $this->params['decalage-x-img'];
$centery = $height/2 + $this->params['decalage-y-img'];
$divisions = count($points);
$angle_pas = (1/$divisions) * 2 * pi() ;
$angle_pas_degres = ($angle_pas/pi())*180;
$id = $this->getId();
// header ("Content-type: image/png");
$img = imagecreatetruecolor($width,$height);
imagealphablending($img, false);
imagesavealpha($img,true);
$transparent = imagecolorallocatealpha($img, 255, 255, 255, 127);
imagefilledrectangle($img, 0, 0, $width, $height, $transparent);
imagealphablending($img, true);
$oldx = 0;
$oldy = 0;
//on initialise l'angle
$angle = $startangle;
//on récupère la position du dernier point de la liste
$lastpoint = end($points);
$oldx = round($centerx - (($radius*$lastpoint['points']/100) * cos($angle-$angle_pas)));
$oldy = round($centery - (($radius*$lastpoint['points']/100) * sin($angle-$angle_pas)));
$oldpoints = $lastpoint['points'];
foreach($points as $key=>$point){
//on dessine le triangle coloré en utilisant la valeur du point précédent
$x = round($centerx - (($radius*$point['points']/100) * cos($angle)));
$y = round($centery - (($radius*$point['points']/100) * sin($angle)));
$intermediatex = round($centerx - (($radius*min($point['points'], $oldpoints)/100) * cos($angle)));
$intermediatey = round($centery - (($radius*min($point['points'], $oldpoints)/100) * sin($angle)));
$intermediateoldx = round($centerx - (($radius*min($point['points'], $oldpoints)/100) * cos($angle-$angle_pas)));
$intermediateoldy = round($centery - (($radius*min($point['points'], $oldpoints)/100) * sin($angle-$angle_pas)));
imagefilledpolygon($img, array($centerx,$centery,$x,$y,$oldx,$oldy), 3, colorAllocateFromString($img,$point['couleur']));
$oldx = $x; $oldy = $y; $oldpoints = $point['points'];
//on dessine le texte
$x = round($centerx - (($radius + $more_radius + $this->params['rayon-du-texte']) * cos($angle)));
$y = round($centery - (($radius + $more_radius + $this->params['rayon-du-texte']) * sin($angle)));
// $lbl = $this->properText($point['label']);
$lbl = $this->properText(mb_strtoupper($axes[$key]['label']));
$dimensions = imagettfbbox($this->params['taille-des-labels'], 0, "./styles/fonts/arial.ttf", $lbl);
//en choisissant le type d'anchor
if($angle >= 3*pi()/4 && $angle <= 5*pi()/4 )
$text_anchor = 0;
elseif(($angle < 3*pi()/4 && $angle > pi()/4) || ($angle > 5*pi()/4 && $angle < 7*pi()/4))
$text_anchor = abs($dimensions[4] - $dimensions[0])/2;
else
$text_anchor = abs($dimensions[4] - $dimensions[0]);
//$sortie .= "s$id.text($x,$y,\"".$point['label']."\").attr({fill:'".$point['couleur']."','font-size':'".$this->params['taille-des-labels']."px',textAnchor:'$text_anchor','dominant-baseline':'middle'}); ";
imagettftext($img, $this->params['taille-des-labels'], 0, $x-$text_anchor, $y+abs($dimensions[5] - $dimensions[1])/2, colorAllocateFromString($img,$point['couleur']), "./styles/fonts/arial.ttf", $lbl);
//on avance dans l'angle d'un pas
$angle += $angle_pas;
$angle = fmod($angle,(2*pi()));
}
//on dessine les cercles concentriques
$nb_circles = $this->params['nombre-de-cercles-concentriques'];
$pas = $radius/$nb_circles;
imagesetthickness($img, (int) round($this->params['epaisseur-des-traits']));
for($tmpradius = $radius; $tmpradius >= $pas; $tmpradius -= $pas){
imagefilledellipse($img, $centerx, $centery, $tmpradius*2 , $tmpradius*2 , colorAllocateFromString($img,$this->params['couleur-et-opacite-des-disques-concentriques']) );
for ($brd=0; $brd < $this->params['epaisseur-des-traits']; $brd++)
imageellipse($img, $centerx, $centery, ($tmpradius+$brd)*2 , ($tmpradius+$brd)*2 , colorAllocateFromString($img,$this->params['couleur-des-cercles-concentriques']) );}
$angle = $startangle;
foreach($points as $point){
//on dessine les lignes radiantes
$x = round($centerx - (($radius + $more_radius) * cos($angle)));
$y = round($centery - (($radius + $more_radius) * sin($angle)));
imageline($img, $centerx, $centery, $x, $y, colorAllocateFromString($img,$this->params['couleur-des-lignes-radiantes']));
//on dessin un petit point gris et le rectangle avec la valeure
$x = round($centerx - (($radius*$point['points']/100) * cos($angle)));
$y = round($centery - (($radius*$point['points']/100) * sin($angle)));
$rectWidth = 30;
$rectHeight = 20;
imagefilledellipse($img, $x, $y, $this->params['taille-des-points']*2 ,$this->params['taille-des-points']*2 , colorAllocateFromString($img,$this->params['couleur-des-points']));
//on dessine le texte
$dimensions = imagettfbbox($this->params['taille-du-texte-indicateur-de-points'], 0, "./styles/fonts/arial.ttf", utf8_decode($point['points']));
$text_anchor = abs($dimensions[4] - $dimensions[0])/2;
//$sortie .= "s$id.text($x,$y,\"".$point['label']."\").attr({fill:'".$point['couleur']."','font-size':'".$this->params['taille-des-labels']."px',textAnchor:'$text_anchor','dominant-baseline':'middle'}); ";
$marge = 20;
$top = 50+$marge;
imagefilledrectangle ($img, $x-$marge-$text_anchor, $y-$marge-$top-abs($dimensions[5]-$dimensions[1])/2, $x+$marge+$text_anchor, $y-$top+$marge+abs($dimensions[5] - $dimensions[1])/2, colorAllocateFromString($img,'rgba(50,50,50,0.5)'));
imagettftext($img, $this->params['taille-du-texte-indicateur-de-points'], 0, $x-$text_anchor, $y-$top+abs($dimensions[5] - $dimensions[1])/2, colorAllocateFromString($img,'white'), "./styles/fonts/arial.ttf", utf8_decode($point['points']));
$angle += $angle_pas;
$angle = fmod($angle,(2*pi()));
}
$img_fin = imagecreatetruecolor($width_fin,$height_fin);
imagealphablending($img_fin, false);
imagesavealpha($img_fin,true);
$transparent = imagecolorallocatealpha($img_fin, 255, 255, 255, 127);
imagefilledrectangle($img_fin, 0, 0, $width, $height, $transparent);
imagecopyresampled($img_fin,$img,0,0,0,0,$width_fin,$height_fin,$width,$height);
imagepng($img_fin,$this->params['image-output'],9);
imagedestroy($img_fin);
imagedestroy($img);
return;
}
private function properText($text){
// Convert UTF-8 string to HTML entities
$text = mb_convert_encoding($text, 'HTML-ENTITIES',"UTF-8");
// Convert HTML entities into ISO-8859-1
$text = html_entity_decode($text,ENT_NOQUOTES, "ISO-8859-1");
// Convert characters > 127 into their hexidecimal equivalents
$out = "";
for($i = 0; $i < strlen($text); $i++) {
$letter = $text[$i];
$num = ord($letter);
if($num>127) {
$out .= "$num;";
} else {
$out .= $letter;
}
}
return($out);
}
function radarSnapWithRotation($points,$width,$height,$radius,$more_radius,$startangle,$speedfactor,$axes){
$centerx = $width/2;
$centery = $height/2;
$divisions = max(1,count($points));
$angle_pas = (1/$divisions) * 2 * pi();
$angle_pas_degres = 360/$divisions;
$id = $this->getId();
$sortie = "
";
}
}
function colorAllocateFromString($img,$CSSColor){
$rgba = parseColor($CSSColor);
if(isset($rgba['a']))
return imagecolorallocatealpha( $img, (int)$rgba['r'], (int)$rgba['g'], (int)$rgba['b'], (int)$rgba['a']);
else
return imagecolorallocate( $img, (int)$rgba['r'], (int)$rgba['g'], (int)$rgba['b']);}
function parseColor($CSScolor){
$CSScolor = strtolower(str_replace(' ','',$CSScolor));// on vire les espaces qui font foirer les regex et cie
if(preg_match("#^\#[a-z0-9]{6}$#",$CSScolor)){//#FFFFFF
return array('r'=>hexdec(substr($CSScolor,1,2)),'g'=>hexdec(substr($CSScolor,3,2)),'b'=>hexdec(substr($CSScolor,5,2)));
}
elseif(preg_match("#^\#[a-z0-9]{3}$#",$CSScolor)){//#FFF
return array('r'=>hexdec($CSScolor[1])*15,'g'=>hexdec($CSScolor[2])*15,'b'=>hexdec($CSScolor[3])*15);
}
elseif(preg_match("#^rgb\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3}\)$#",$CSScolor))
{
$values = explode(',',substr($CSScolor,4,-1));
return array('r'=>(int)$values[0],'g'=>(int)$values[1],'b'=>(int)$values[2]);
}
elseif(preg_match("#^rgba\([0-9\.]+,[0-9\.]+,[0-9\.]+,[0-9\.]+\)$#",$CSScolor))//rgb(255,255,255)
{
$values = explode(',',substr($CSScolor,5,-1));
return array('r'=>(int)$values[0],'g'=>(int)$values[1],'b'=>(int)$values[2],'a'=>(int)round((1-$values[3])*127));
}
elseif(preg_match("#^hs(l|v)\([0-9\.]+,[0-9\.]+%,[0-9\.]+%\)$#",$CSScolor) || $alpha = preg_match("#^hs(l|v)a\([0-9\.]+,[0-9\.]+%,[0-9\.]+%,[0-9\.]+\)$#",$CSScolor))
{//hsl(0,50%,100%) ou hsla(0,50%,100%,0.5) ou //hsv(0,50%,100%) ou hsa(0,50%,100%,0.5)
//on sépare les paramètres
if($alpha)//si hsla(
$values = explode(',',substr($CSScolor,5,-1));
else//si hsl(
$values = explode(',',substr($CSScolor,4,-1));
//on récupère les paramètres
$h=(int)round(fmod($values[0],360));
$s=max(0,min(1,substr($values[1],0,-1)/100));
$l=max(0,min(1,substr($values[2],0,-1)/100));
//on calcule la transformation (http://www.rapidtables.com/convert/color/hsl-to-rgb.htm et http://www.rapidtables.com/convert/color/hsv-to-rgb.htm)
if(substr($CSScolor,0,3) == 'hsl'){
$c = (1 - abs(2*$l - 1)) * $s;
$m = $l - $c/2;
}
elseif(substr($CSScolor,0,3) == 'hsv'){
$c = $l * $s;
$m = $l - $c;
}
$x = $c * (1 - abs(fmod(($h/60),2)-1));
//on normalise
$c = (int)round(( $c )*255);
$x = (int)round(( $x )*255);
$m = (int)round(( $m )*255);
//puis on réparti les résultats en fontion de H
if(0 <= $h && $h < 60) $sortie = array('r'=>$c+$m,'g'=>$x+$m,'b'=>0+$m);
elseif(60 <= $h && $h < 120) $sortie = array('r'=>$x+$m,'g'=>$c+$m,'b'=>0+$m);
elseif(120 <= $h && $h < 180) $sortie = array('r'=>0+$m,'g'=>$c+$m,'b'=>$x+$m);
elseif(180 <= $h && $h < 240) $sortie = array('r'=>0+$m,'g'=>$x+$m,'b'=>$c+$m);
elseif(240 <= $h && $h < 300) $sortie = array('r'=>$x+$m,'g'=>0+$m,'b'=>$c+$m);
elseif(300 <= $h && $h < 360) $sortie = array('r'=>$c+$m,'g'=>0+$m,'b'=>$x+$m);
if($alpha)//si alpha on ajoute la composante
$sortie['a'] = (int)round((1-$values[3])*127);
return $sortie;
}
else{
$colors = array(
"black"=>array( "r"=>0x00, "g"=>0x00, "b"=>0x00),
"maroon"=>array( "r"=>0x80, "g"=>0x00, "b"=>0x00),
"green"=>array( "r"=>0x00, "g"=>0x80, "b"=>0x00),
"olive"=>array( "r"=>0x80, "g"=>0x80, "b"=>0x00),
"navy"=>array( "r"=>0x00, "g"=>0x00, "b"=>0x80),
"purple"=>array( "r"=>0x80, "g"=>0x00, "b"=>0x80),
"teal"=>array( "r"=>0x00, "g"=>0x80, "b"=>0x80),
"gray"=>array( "r"=>0x80, "g"=>0x80, "b"=>0x80),
"silver"=>array( "r"=>0xC0, "g"=>0xC0, "b"=>0xC0),
"red"=>array( "r"=>0xFF, "g"=>0x00, "b"=>0x00),
"lime"=>array( "r"=>0x00, "g"=>0xFF, "b"=>0x00),
"yellow"=>array( "r"=>0xFF, "g"=>0xFF, "b"=>0x00),
"blue"=>array( "r"=>0x00, "g"=>0x00, "b"=>0xFF),
"fuchsia"=>array( "r"=>0xFF, "g"=>0x00, "b"=>0xFF),
"aqua"=>array( "r"=>0x00, "g"=>0xFF, "b"=>0xFF),
"white"=>array( "r"=>0xFF, "g"=>0xFF, "b"=>0xFF),
"aliceblue"=>array( "r"=>0xF0, "g"=>0xF8, "b"=>0xFF),
"antiquewhite"=>array( "r"=>0xFA, "g"=>0xEB, "b"=>0xD7),
"aquamarine"=>array( "r"=>0x7F, "g"=>0xFF, "b"=>0xD4),
"azure"=>array( "r"=>0xF0, "g"=>0xFF, "b"=>0xFF),
"beige"=>array( "r"=>0xF5, "g"=>0xF5, "b"=>0xDC),
"blueviolet"=>array( "r"=>0x8A, "g"=>0x2B, "b"=>0xE2),
"brown"=>array( "r"=>0xA5, "g"=>0x2A, "b"=>0x2A),
"burlywood"=>array( "r"=>0xDE, "g"=>0xB8, "b"=>0x87),
"cadetblue"=>array( "r"=>0x5F, "g"=>0x9E, "b"=>0xA0),
"chartreuse"=>array( "r"=>0x7F, "g"=>0xFF, "b"=>0x00),
"chocolate"=>array( "r"=>0xD2, "g"=>0x69, "b"=>0x1E),
"coral"=>array( "r"=>0xFF, "g"=>0x7F, "b"=>0x50),
"cornflowerblue"=>array( "r"=>0x64, "g"=>0x95, "b"=>0xED),
"cornsilk"=>array( "r"=>0xFF, "g"=>0xF8, "b"=>0xDC),
"crimson"=>array( "r"=>0xDC, "g"=>0x14, "b"=>0x3C),
"darkblue"=>array( "r"=>0x00, "g"=>0x00, "b"=>0x8B),
"darkcyan"=>array( "r"=>0x00, "g"=>0x8B, "b"=>0x8B),
"darkgoldenrod"=>array( "r"=>0xB8, "g"=>0x86, "b"=>0x0B),
"darkgray"=>array( "r"=>0xA9, "g"=>0xA9, "b"=>0xA9),
"darkgreen"=>array( "r"=>0x00, "g"=>0x64, "b"=>0x00),
"darkkhaki"=>array( "r"=>0xBD, "g"=>0xB7, "b"=>0x6B),
"darkmagenta"=>array( "r"=>0x8B, "g"=>0x00, "b"=>0x8B),
"darkolivegreen"=>array( "r"=>0x55, "g"=>0x6B, "b"=>0x2F),
"darkorange"=>array( "r"=>0xFF, "g"=>0x8C, "b"=>0x00),
"darkorchid"=>array( "r"=>0x99, "g"=>0x32, "b"=>0xCC),
"darkred"=>array( "r"=>0x8B, "g"=>0x00, "b"=>0x00),
"darksalmon"=>array( "r"=>0xE9, "g"=>0x96, "b"=>0x7A),
"darkseagreen"=>array( "r"=>0x8F, "g"=>0xBC, "b"=>0x8F),
"darkslateblue"=>array( "r"=>0x48, "g"=>0x3D, "b"=>0x8B),
"darkslategray"=>array( "r"=>0x2F, "g"=>0x4F, "b"=>0x4F),
"darkturquoise"=>array( "r"=>0x00, "g"=>0xCE, "b"=>0xD1),
"darkviolet"=>array( "r"=>0x94, "g"=>0x00, "b"=>0xD3),
"deeppink"=>array( "r"=>0xFF, "g"=>0x14, "b"=>0x93),
"deepskyblue"=>array( "r"=>0x00, "g"=>0xBF, "b"=>0xFF),
"dimgray"=>array( "r"=>0x69, "g"=>0x69, "b"=>0x69),
"dodgerblue"=>array( "r"=>0x1E, "g"=>0x90, "b"=>0xFF),
"firebrick"=>array( "r"=>0xB2, "g"=>0x22, "b"=>0x22),
"floralwhite"=>array( "r"=>0xFF, "g"=>0xFA, "b"=>0xF0),
"forestgreen"=>array( "r"=>0x22, "g"=>0x8B, "b"=>0x22),
"gainsboro"=>array( "r"=>0xDC, "g"=>0xDC, "b"=>0xDC),
"ghostwhite"=>array( "r"=>0xF8, "g"=>0xF8, "b"=>0xFF),
"gold"=>array( "r"=>0xFF, "g"=>0xD7, "b"=>0x00),
"goldenrod"=>array( "r"=>0xDA, "g"=>0xA5, "b"=>0x20),
"greenyellow"=>array( "r"=>0xAD, "g"=>0xFF, "b"=>0x2F),
"honeydew"=>array( "r"=>0xF0, "g"=>0xFF, "b"=>0xF0),
"hotpink"=>array( "r"=>0xFF, "g"=>0x69, "b"=>0xB4),
"indianred"=>array( "r"=>0xCD, "g"=>0x5C, "b"=>0x5C),
"indigo"=>array( "r"=>0x4B, "g"=>0x00, "b"=>0x82),
"ivory"=>array( "r"=>0xFF, "g"=>0xFF, "b"=>0xF0),
"khaki"=>array( "r"=>0xF0, "g"=>0xE6, "b"=>0x8C),
"lavender"=>array( "r"=>0xE6, "g"=>0xE6, "b"=>0xFA),
"lavenderblush"=>array( "r"=>0xFF, "g"=>0xF0, "b"=>0xF5),
"lawngreen"=>array( "r"=>0x7C, "g"=>0xFC, "b"=>0x00),
"lemonchiffon"=>array( "r"=>0xFF, "g"=>0xFA, "b"=>0xCD),
"lightblue"=>array( "r"=>0xAD, "g"=>0xD8, "b"=>0xE6),
"lightcoral"=>array( "r"=>0xF0, "g"=>0x80, "b"=>0x80),
"lightcyan"=>array( "r"=>0xE0, "g"=>0xFF, "b"=>0xFF),
"lightgoldenrodyellow"=>array( "r"=>0xFA, "g"=>0xFA, "b"=>0xD2),
"lightgreen"=>array( "r"=>0x90, "g"=>0xEE, "b"=>0x90),
"lightgrey"=>array( "r"=>0xD3, "g"=>0xD3, "b"=>0xD3),
"lightpink"=>array( "r"=>0xFF, "g"=>0xB6, "b"=>0xC1),
"lightsalmon"=>array( "r"=>0xFF, "g"=>0xA0, "b"=>0x7A),
"lightseagreen"=>array( "r"=>0x20, "g"=>0xB2, "b"=>0xAA),
"lightskyblue"=>array( "r"=>0x87, "g"=>0xCE, "b"=>0xFA),
"lightslategray"=>array( "r"=>0x77, "g"=>0x88, "b"=>0x99),
"lightsteelblue"=>array( "r"=>0xB0, "g"=>0xC4, "b"=>0xDE),
"lightyellow"=>array( "r"=>0xFF, "g"=>0xFF, "b"=>0xE0),
"limegreen"=>array( "r"=>0x32, "g"=>0xCD, "b"=>0x32),
"linen"=>array( "r"=>0xFA, "g"=>0xF0, "b"=>0xE6),
"mediumaquamarine"=>array( "r"=>0x66, "g"=>0xCD, "b"=>0xAA),
"mediumblue"=>array( "r"=>0x00, "g"=>0x00, "b"=>0xCD),
"mediumorchid"=>array( "r"=>0xBA, "g"=>0x55, "b"=>0xD3),
"mediumpurple"=>array( "r"=>0x93, "g"=>0x70, "b"=>0xD0),
"mediumseagreen"=>array( "r"=>0x3C, "g"=>0xB3, "b"=>0x71),
"mediumslateblue"=>array( "r"=>0x7B, "g"=>0x68, "b"=>0xEE),
"mediumspringgreen"=>array( "r"=>0x00, "g"=>0xFA, "b"=>0x9A),
"mediumturquoise"=>array( "r"=>0x48, "g"=>0xD1, "b"=>0xCC),
"mediumvioletred"=>array( "r"=>0xC7, "g"=>0x15, "b"=>0x85),
"midnightblue"=>array( "r"=>0x19, "g"=>0x19, "b"=>0x70),
"mintcream"=>array( "r"=>0xF5, "g"=>0xFF, "b"=>0xFA),
"mistyrose"=>array( "r"=>0xFF, "g"=>0xE4, "b"=>0xE1),
"moccasin"=>array( "r"=>0xFF, "g"=>0xE4, "b"=>0xB5),
"navajowhite"=>array( "r"=>0xFF, "g"=>0xDE, "b"=>0xAD),
"oldlace"=>array( "r"=>0xFD, "g"=>0xF5, "b"=>0xE6),
"olivedrab"=>array( "r"=>0x6B, "g"=>0x8E, "b"=>0x23),
"orange"=>array( "r"=>0xFF, "g"=>0xA5, "b"=>0x00),
"orangered"=>array( "r"=>0xFF, "g"=>0x45, "b"=>0x00),
"orchid"=>array( "r"=>0xDA, "g"=>0x70, "b"=>0xD6),
"palegoldenrod"=>array( "r"=>0xEE, "g"=>0xE8, "b"=>0xAA),
"palegreen"=>array( "r"=>0x98, "g"=>0xFB, "b"=>0x98),
"paleturquoise"=>array( "r"=>0xAF, "g"=>0xEE, "b"=>0xEE),
"palevioletred"=>array( "r"=>0xDB, "g"=>0x70, "b"=>0x93),
"papayawhip"=>array( "r"=>0xFF, "g"=>0xEF, "b"=>0xD5),
"peachpuff"=>array( "r"=>0xFF, "g"=>0xDA, "b"=>0xB9),
"peru"=>array( "r"=>0xCD, "g"=>0x85, "b"=>0x3F),
"pink"=>array( "r"=>0xFF, "g"=>0xC0, "b"=>0xCB),
"plum"=>array( "r"=>0xDD, "g"=>0xA0, "b"=>0xDD),
"powderblue"=>array( "r"=>0xB0, "g"=>0xE0, "b"=>0xE6),
"rosybrown"=>array( "r"=>0xBC, "g"=>0x8F, "b"=>0x8F),
"royalblue"=>array( "r"=>0x41, "g"=>0x69, "b"=>0xE1),
"saddlebrown"=>array( "r"=>0x8B, "g"=>0x45, "b"=>0x13),
"salmon"=>array( "r"=>0xFA, "g"=>0x80, "b"=>0x72),
"sandybrown"=>array( "r"=>0xF4, "g"=>0xA4, "b"=>0x60),
"seagreen"=>array( "r"=>0x2E, "g"=>0x8B, "b"=>0x57),
"seashell"=>array( "r"=>0xFF, "g"=>0xF5, "b"=>0xEE),
"sienna"=>array( "r"=>0xA0, "g"=>0x52, "b"=>0x2D),
"skyblue"=>array( "r"=>0x87, "g"=>0xCE, "b"=>0xEB),
"slateblue"=>array( "r"=>0x6A, "g"=>0x5A, "b"=>0xCD),
"slategray"=>array( "r"=>0x70, "g"=>0x80, "b"=>0x90),
"snow"=>array( "r"=>0xFF, "g"=>0xFA, "b"=>0xFA),
"springgreen"=>array( "r"=>0x00, "g"=>0xFF, "b"=>0x7F),
"steelblue"=>array( "r"=>0x46, "g"=>0x82, "b"=>0xB4),
"tan"=>array( "r"=>0xD2, "g"=>0xB4, "b"=>0x8C),
"thistle"=>array( "r"=>0xD8, "g"=>0xBF, "b"=>0xD8),
"tomato"=>array( "r"=>0xFF, "g"=>0x63, "b"=>0x47),
"turquoise"=>array( "r"=>0x40, "g"=>0xE0, "b"=>0xD0),
"violet"=>array( "r"=>0xEE, "g"=>0x82, "b"=>0xEE),
"wheat"=>array( "r"=>0xF5, "g"=>0xDE, "b"=>0xB3),
"whitesmoke"=>array( "r"=>0xF5, "g"=>0xF5, "b"=>0xF5),
"yellowgreen"=>array( "r"=>0x9A, "g"=>0xCD, "b"=>0x32));
if(isset($colors[$CSScolor]))
return $colors[$CSScolor];
else
return false;
}
}