mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 23:26:45 +08:00
refactor cpu gauge into standalone widget
This commit is contained in:
12
util.go
12
util.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user