mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
add common status colors to global theme
This commit is contained in:
@@ -45,6 +45,9 @@ var ColorMap = map[string]ui.Attribute{
|
|||||||
"par.text.hi": ui.ColorBlack,
|
"par.text.hi": ui.ColorBlack,
|
||||||
"sparkline.line.fg": ui.ColorGreen,
|
"sparkline.line.fg": ui.ColorGreen,
|
||||||
"sparkline.title.fg": ui.ColorWhite,
|
"sparkline.title.fg": ui.ColorWhite,
|
||||||
|
"status.ok": ui.ColorGreen,
|
||||||
|
"status.warn": ui.ColorYellow,
|
||||||
|
"status.danger": ui.ColorRed,
|
||||||
}
|
}
|
||||||
|
|
||||||
func InvertColorMap() {
|
func InvertColorMap() {
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ func (w *GaugeCol) Reset() {
|
|||||||
|
|
||||||
func colorScale(n int) ui.Attribute {
|
func colorScale(n int) ui.Attribute {
|
||||||
if n > 70 {
|
if n > 70 {
|
||||||
return ui.ColorRed
|
return ui.ThemeAttr("status.danger")
|
||||||
}
|
}
|
||||||
if n > 30 {
|
if n > 30 {
|
||||||
return ui.ColorYellow
|
return ui.ThemeAttr("status.warn")
|
||||||
}
|
}
|
||||||
return ui.ColorGreen
|
return ui.ThemeAttr("status.ok")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ func (s *Status) Set(val string) {
|
|||||||
|
|
||||||
switch val {
|
switch val {
|
||||||
case "running":
|
case "running":
|
||||||
color = ui.ColorGreen
|
color = ui.ThemeAttr("status.ok")
|
||||||
case "exited":
|
case "exited":
|
||||||
color = ui.ColorRed
|
color = ui.ThemeAttr("status.danger")
|
||||||
case "paused":
|
case "paused":
|
||||||
text = fmt.Sprintf("%s%s", vBar, vBar)
|
text = fmt.Sprintf("%s%s", vBar, vBar)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ func (w *TextCol) Color(s string){
|
|||||||
}
|
}
|
||||||
switch s {
|
switch s {
|
||||||
case "healthy":
|
case "healthy":
|
||||||
color = ui.ColorGreen
|
color = ui.ThemeAttr("status.ok")
|
||||||
case "unhealthy":
|
case "unhealthy":
|
||||||
color = ui.ColorMagenta
|
color = ui.ThemeAttr("status.danger")
|
||||||
case "starting":
|
case "starting":
|
||||||
color = ui.ColorYellow
|
color = ui.ThemeAttr("status.warn")
|
||||||
}
|
}
|
||||||
w.TextFgColor = color
|
w.TextFgColor = color
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user