Unified usages of Karma-Gauge in new ElementBuilder

This commit is contained in:
Alexander Nell
2020-04-24 18:52:18 +02:00
parent c2064c8d78
commit 66eb685688
8 changed files with 448 additions and 166 deletions

View File

@ -21,7 +21,7 @@ abstract class ColorUtil implements UsageInformationAble {
* @param float $value
* @return string
*/
public static function floatToStatusColor($value) {
public static function floatToStatusColor($value, $addBlue = true) {
$value = floatval($value);
$red = 1.;
$green = 1.;
@ -33,7 +33,12 @@ abstract class ColorUtil implements UsageInformationAble {
}
$red = ColorUtil::floatToCode($red);
$green = ColorUtil::floatToCode($green);
return $red . $green . '0';
if ($addBlue) {
return $red . $green . '0';
} else {
return $red . $green;
}
}
/**
@ -55,7 +60,7 @@ abstract class ColorUtil implements UsageInformationAble {
if ($value < 10) {
return (string) $value;
}
$codes = array(10 => 'a', 11 => 'b', 12 => 'c', 13 => 'd', 14 => 'e', 15 => 'f');
static $codes = array(10 => 'a', 11 => 'b', 12 => 'c', 13 => 'd', 14 => 'e', 15 => 'f');
return $codes[$value];
}
}