refactor cpu gauge into standalone widget

This commit is contained in:
Bradley Cicenas
2017-01-06 02:01:57 +00:00
parent 11376c24e4
commit 3ec384414d
5 changed files with 56 additions and 26 deletions

12
util.go
View File

@@ -4,8 +4,6 @@ import (
"fmt"
"math"
"strconv"
ui "github.com/gizak/termui"
)
const (
@@ -33,13 +31,3 @@ func byteFormat(n int64) string {
func round(num float64) int {
return int(num + math.Copysign(0.5, num))
}
func colorScale(n int) ui.Attribute {
if n > 70 {
return ui.ColorRed
}
if n > 30 {
return ui.ColorYellow
}
return ui.ColorGreen
}