mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
27 lines
369 B
Go
27 lines
369 B
Go
|
package widgets
|
||
|
|
||
|
import (
|
||
|
ui "github.com/gizak/termui"
|
||
|
)
|
||
|
|
||
|
func mkGauge() *ui.Gauge {
|
||
|
g := ui.NewGauge()
|
||
|
g.Height = 1
|
||
|
g.Border = false
|
||
|
g.Percent = 0
|
||
|
g.PaddingBottom = 0
|
||
|
g.BarColor = ui.ColorGreen
|
||
|
g.Label = "-"
|
||
|
return g
|
||
|
}
|
||
|
|
||
|
func colorScale(n int) ui.Attribute {
|
||
|
if n > 70 {
|
||
|
return ui.ColorRed
|
||
|
}
|
||
|
if n > 30 {
|
||
|
return ui.ColorYellow
|
||
|
}
|
||
|
return ui.ColorGreen
|
||
|
}
|