Here's one...
/*
I stole this from Helpbot, and modified it to take a targetlevel
and a requestor level instead of a percentage.
I also modified the return value to be just a HTML color code (#XXXXXX)
Thanks Beaker for this handy function! http://www.kuren.org/ao/helpbot/
This function returns the color code of the color the hp bar that a
player of requestorlevel would see for a player of targetlevel.
ie:
if requestorlevel is 220 and targetlevel is 5, a grey color code would be returned.
if requestorlevel is 220 and targetlevel is 200, a greenish color code would be returned.
if requesterlevel is 200 and targetlevel is 220, a orangish/redish color code would be returned.
if requestorlevel and targetlevel are equal, a yello color code is returned.
*/
function con2rgb($targetlevel, $requestorlevel)
{ // Start function con2rgb()
$percent = $targetlevel/$requestorlevel*100.000001;
$G = 214.0001-(($percent-100.0001)/100.0001)*4.0001*214.0001;
if ($G<0)
$G=0;
elseif ($G>214)
$G="D6";
else
{
if ($G<16)
$G=sprintf("0%X",$G);
else
$G=sprintf("%X",$G);
}
$R = 214.00001-(100.0001-$percent)*4.0001/100.0001*214.0001;
if ($R<0)
$R=0;
elseif ($R>214)
$R="D6";
else
{
if ($R<16)
$R=sprintf("0%X",$R);
else
$R=sprintf("%X",$R);
}
if ($percent<75.0001)
return "#909090";
if ($percent>124.9999)
return "#D60000";
return "#".$R.$G."00";
} // End function con2rgb()