Set default Pending color to calming darkorange

mine
Richard Whitehead 2020-05-23 21:09:13 -07:00
parent 9f9812b897
commit 237d97e6cb
2 changed files with 15 additions and 21 deletions

View File

@ -259,7 +259,7 @@ func newStatus() Status {
NewColor: "lightskyblue",
ModifyColor: "greenyellow",
AddColor: "dodgerblue",
PendingColor: "orangered",
PendingColor: "darkorange",
ErrorColor: "orangered",
HighlightColor: "aqua",
KillColor: "mediumpurple",

View File

@ -37,9 +37,18 @@ type ContainerWithMetrics interface {
// Container renders a K8s Container to screen.
type Container struct{}
// ColorGet returns a color for a state
func ColorGet(s string,ns string, h Header, re RowEvent) tcell.Color {
switch s {
// ColorerFunc colors a resource row.
func (c Container) ColorerFunc() ColorerFunc {
return func(ns string, h Header, re RowEvent) tcell.Color {
if !Happy(ns, h, re.Row) {
return ErrColor
}
stateCol := h.IndexOf("STATE", true)
if stateCol == -1 {
return DefaultColorer(ns, h, re)
}
switch strings.TrimSpace(re.Row.Fields[stateCol]) {
case Pending:
return PendingColor
case ContainerCreating, PodInitializing:
@ -53,21 +62,6 @@ func ColorGet(s string,ns string, h Header, re RowEvent) tcell.Color {
default:
return ErrColor
}
}
// ColorerFunc colors a resource row.
func (c Container) ColorerFunc() ColorerFunc {
return func(ns string, h Header, re RowEvent) tcell.Color {
if !Happy(ns, h, re.Row) {
return ErrColor
}
stateCol := h.IndexOf("STATE", true)
if stateCol == -1 {
return DefaultColorer(ns, h, re)
}
return ColorGet(strings.TrimSpace(re.Row.Fields[stateCol]), ns, h, re)
}
}