forked from derailed/k9s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor.go
51 lines (39 loc) · 957 Bytes
/
color.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of K9s
package model1
import "github.com/derailed/tcell/v2"
var (
// ModColor row modified color.
ModColor tcell.Color
// AddColor row added color.
AddColor tcell.Color
// PendingColor row added color.
PendingColor tcell.Color
// ErrColor row err color.
ErrColor tcell.Color
// StdColor row default color.
StdColor tcell.Color
// HighlightColor row highlight color.
HighlightColor tcell.Color
// KillColor row deleted color.
KillColor tcell.Color
// CompletedColor row completed color.
CompletedColor tcell.Color
)
// DefaultColorer set the default table row colors.
func DefaultColorer(ns string, h Header, re *RowEvent) tcell.Color {
if !IsValid(ns, h, re.Row) {
return ErrColor
}
// nolint:exhaustive
switch re.Kind {
case EventAdd:
return AddColor
case EventUpdate:
return ModColor
case EventDelete:
return KillColor
default:
return StdColor
}
}