From 7632420ecc052ebbbacde1a6635c72c5dd26072f Mon Sep 17 00:00:00 2001 From: Sergey Ponomarev Date: Tue, 24 Nov 2020 00:22:25 +0200 Subject: [PATCH 1/2] cpu color: check lower values first this is simpler to understand and faster for usual containers --- cwidgets/compact/gauge.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cwidgets/compact/gauge.go b/cwidgets/compact/gauge.go index 3d3169e..971eb28 100644 --- a/cwidgets/compact/gauge.go +++ b/cwidgets/compact/gauge.go @@ -100,11 +100,11 @@ func (w *GaugeCol) UnHighlight() { } func colorScale(n int) ui.Attribute { - if n > 70 { - return ui.ThemeAttr("status.danger") + if n <= 30 { + return ui.ThemeAttr("status.ok") } - if n > 30 { + if n <= 70 { return ui.ThemeAttr("status.warn") } - return ui.ThemeAttr("status.ok") + return ui.ThemeAttr("status.danger") } From 4973bc83ff02f4acaaca73dd54e7f7ea03557c64 Mon Sep 17 00:00:00 2001 From: Sergey Ponomarev Date: Tue, 24 Nov 2020 00:51:09 +0200 Subject: [PATCH 2/2] cpu color: make threshold upper: > 70% warn and > 90% is danger --- cwidgets/compact/gauge.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cwidgets/compact/gauge.go b/cwidgets/compact/gauge.go index 971eb28..39fccdc 100644 --- a/cwidgets/compact/gauge.go +++ b/cwidgets/compact/gauge.go @@ -100,10 +100,10 @@ func (w *GaugeCol) UnHighlight() { } func colorScale(n int) ui.Attribute { - if n <= 30 { + if n <= 70 { return ui.ThemeAttr("status.ok") } - if n <= 70 { + if n <= 90 { return ui.ThemeAttr("status.warn") } return ui.ThemeAttr("status.danger")