Revision: 48961
Updated Code
at June 8, 2012 12:52 by chopbust
Updated Code
//color temperatures (for funsies) //straight = red to green, reverse = green to red
function getTemperatureColor($percentage, $type="straight") {
$colors = array("#ff0200", "#ff270a", "#ff5306" ,"#ffa801", "#ffd301", "#eef302", "#c0ff02", "#73ff01", "#27ff01", "#00ff00");
$colors = array("#c43c35", "#d65227", "#f27312" ,"#f57711", "#f8840a", "#e89b0a", "#bda119", "#9fa225", "#7ba332", "#47a546");
if ($type == "reverse") {
$colors = array_reverse($colors);
}
if ($percentage >= 100) {
return $colors[9];
} else if ($percentage <= 9) {
return $colors[0];
}
//for the double digits
$number = floor($percentage / 10);
return $colors[$number];
}
Revision: 48960
Updated Code
at July 13, 2011 16:03 by chopbust
Updated Code
//color temperatures (for funsies) //straight = red to green, reverse = green to red
function getTemperatureColor($percentage, $type="straight") {
$colors = array("#ff0200", "#ff270a", "#ff5306" ,"#ffa801", "#ffd301", "#eef302", "#c0ff02", "#73ff01", "#27ff01", "#00ff00");
if ($type == "reverse") {
$colors = array_reverse($colors);
}
if ($percentage >= 100) {
return $colors[9];
} else if ($percentage <= 9) {
return $colors[0];
}
//for the double digits
$number = floor($percentage / 10);
return $colors[$number];
}
Revision: 48959
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 13, 2011 15:59 by chopbust
Initial Code
//color temperatures (for funsies) //straight = red to green, reverse = green to red
function getTemperatureColor($percentage, $type="straight") {
$colors = array("#ff0200", "#ff270a", "#ff5306" ,"#ffa801", "#ffd301", "#eef302", "#c0ff02", "#73ff01", "#27ff01", "#00ff00");
if ($type == "reverse") {
$colors = array_reverse($colors);
}
if ($percentage >= 100) {
return $colors[9];
} else if ($percentage <= 9) {
return $colors[0];
}
//for the double digits
$number = ceil($percentage / 10);
return $colors[$number];
}
Initial URL
Initial Description
Returns the color (red to green) when you give a percentage amount, or reversible.
Initial Title
Temperature Color Array
Initial Tags
Initial Language
PHP