From: Sebastien GODARD Date: Thu, 29 Dec 2022 07:37:18 +0000 (+0100) Subject: A_PWR_BAT: Use colors to display negative values X-Git-Tag: v12.7.2~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0cecd74fa36b5c9151fbb84bd5caaf39f2ffa2d8;p=sysstat A_PWR_BAT: Use colors to display negative values Two thresholds are defined: -10.0 and -5.0. Signed-off-by: Sebastien GODARD --- diff --git a/common.c b/common.c index 256451c..ed144d9 100644 --- a/common.c +++ b/common.c @@ -1411,6 +1411,12 @@ void cprintf_f(int unit, int sign, int num, int wi, int wd, ...) ((wd == 0) && (val <= 0.5) && (val >= -0.5))) { /* "Round half to even" law */ printf("%s", sc_zero_int_stat); } + else if (sign && (val <= -10.0)) { + printf("%s", sc_percent_xtreme); + } + else if (sign && (val <= -5.0)) { + printf("%s", sc_percent_warn); + } else { printf("%s", sc_int_stat); }