mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
add global default ColorMap
This commit is contained in:
@@ -41,7 +41,7 @@ func headerBgBordered() *ui.Par {
|
||||
bg := ui.NewPar("")
|
||||
bg.X = 1
|
||||
bg.Height = 3
|
||||
bg.Bg = ui.ColorWhite
|
||||
bg.Bg = ui.ThemeAttr("header.bg")
|
||||
return bg
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func headerBg() *ui.Par {
|
||||
bg.X = 1
|
||||
bg.Height = 1
|
||||
bg.Border = false
|
||||
bg.Bg = ui.ColorWhite
|
||||
bg.Bg = ui.ThemeAttr("header.bg")
|
||||
return bg
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@ func headerPar(x int, s string) *ui.Par {
|
||||
p.Border = false
|
||||
p.Height = 1
|
||||
p.Width = 20
|
||||
p.TextFgColor = ui.ColorDefault
|
||||
p.TextBgColor = ui.ColorWhite
|
||||
p.Bg = ui.ColorWhite
|
||||
p.Bg = ui.ThemeAttr("header.bg")
|
||||
p.TextFgColor = ui.ThemeAttr("header.fg")
|
||||
p.TextBgColor = ui.ThemeAttr("header.bg")
|
||||
return p
|
||||
}
|
||||
|
||||
@@ -28,10 +28,12 @@ func NewInput() *Input {
|
||||
Block: *ui.NewBlock(),
|
||||
Label: "input",
|
||||
MaxLen: 20,
|
||||
TextFgColor: ui.ThemeAttr("par.text.fg"),
|
||||
TextBgColor: ui.ThemeAttr("par.text.bg"),
|
||||
TextFgColor: ui.ThemeAttr("menu.text.fg"),
|
||||
TextBgColor: ui.ThemeAttr("menu.text.bg"),
|
||||
padding: Padding{4, 2},
|
||||
}
|
||||
i.BorderFg = ui.ThemeAttr("menu.border.fg")
|
||||
i.BorderLabelFg = ui.ThemeAttr("menu.label.fg")
|
||||
i.calcSize()
|
||||
return i
|
||||
}
|
||||
|
||||
@@ -22,11 +22,13 @@ type Menu struct {
|
||||
func NewMenu() *Menu {
|
||||
m := &Menu{
|
||||
Block: *ui.NewBlock(),
|
||||
TextFgColor: ui.ThemeAttr("par.text.fg"),
|
||||
TextBgColor: ui.ThemeAttr("par.text.bg"),
|
||||
TextFgColor: ui.ThemeAttr("menu.text.fg"),
|
||||
TextBgColor: ui.ThemeAttr("menu.text.bg"),
|
||||
cursorPos: 0,
|
||||
padding: Padding{4, 2},
|
||||
}
|
||||
m.BorderFg = ui.ThemeAttr("menu.border.fg")
|
||||
m.BorderLabelFg = ui.ThemeAttr("menu.label.fg")
|
||||
m.X = 1
|
||||
return m
|
||||
}
|
||||
@@ -86,7 +88,7 @@ func (m *Menu) Buffer() ui.Buffer {
|
||||
for _, ch := range item.Text() {
|
||||
// invert bg/fg colors on currently selected row
|
||||
if m.Selectable && n == m.cursorPos {
|
||||
cell = ui.Cell{Ch: ch, Fg: m.TextBgColor, Bg: m.TextFgColor}
|
||||
cell = ui.Cell{Ch: ch, Fg: ui.ColorBlack, Bg: m.TextFgColor}
|
||||
} else {
|
||||
cell = ui.Cell{Ch: ch, Fg: m.TextFgColor, Bg: m.TextBgColor}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user