Add colour config for container picker (#2140)
parent
9d804c6c17
commit
5a8dc2d4b3
|
|
@ -104,6 +104,7 @@ type (
|
|||
Xray Xray `yaml:"xray"`
|
||||
Charts Charts `yaml:"charts"`
|
||||
Yaml Yaml `yaml:"yaml"`
|
||||
Picker Picker `yaml:"picker"`
|
||||
Log Log `yaml:"logs"`
|
||||
}
|
||||
|
||||
|
|
@ -126,6 +127,13 @@ type (
|
|||
Indicator LogIndicator `yaml:"indicator"`
|
||||
}
|
||||
|
||||
// Picker tracks color when selecting containers
|
||||
Picker struct {
|
||||
MainColor Color `yaml:"mainColor"`
|
||||
FocusColor Color `yaml:"focusColor"`
|
||||
ShortcutColor Color `yaml:"shortcutColor"`
|
||||
}
|
||||
|
||||
// LogIndicator tracks log view indicator.
|
||||
LogIndicator struct {
|
||||
FgColor Color `yaml:"fgColor"`
|
||||
|
|
@ -321,6 +329,7 @@ func newViews() Views {
|
|||
Xray: newXray(),
|
||||
Charts: newCharts(),
|
||||
Yaml: newYaml(),
|
||||
Picker: newPicker(),
|
||||
Log: newLog(),
|
||||
}
|
||||
}
|
||||
|
|
@ -370,6 +379,14 @@ func newStatus() Status {
|
|||
}
|
||||
}
|
||||
|
||||
func newPicker() Picker {
|
||||
return Picker{
|
||||
MainColor: "white",
|
||||
FocusColor: "aqua",
|
||||
ShortcutColor: "aqua",
|
||||
}
|
||||
}
|
||||
|
||||
func newLog() Log {
|
||||
return Log{
|
||||
FgColor: "lightskyblue",
|
||||
|
|
|
|||
|
|
@ -30,14 +30,17 @@ func (p *Picker) Init(ctx context.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pickerView := app.Styles.Views().Picker
|
||||
p.actions[tcell.KeyEscape] = ui.NewKeyAction("Back", app.PrevCmd, true)
|
||||
|
||||
p.SetBorder(true)
|
||||
p.SetMainTextColor(tcell.ColorWhite)
|
||||
p.SetMainTextColor(pickerView.MainColor.Color())
|
||||
p.ShowSecondaryText(false)
|
||||
p.SetShortcutColor(tcell.ColorAqua)
|
||||
p.SetSelectedBackgroundColor(tcell.ColorAqua)
|
||||
p.SetShortcutColor(pickerView.ShortcutColor.Color())
|
||||
p.SetSelectedBackgroundColor(pickerView.FocusColor.Color())
|
||||
p.SetTitle(" [aqua::b]Containers Picker ")
|
||||
|
||||
p.SetInputCapture(func(evt *tcell.EventKey) *tcell.EventKey {
|
||||
if a, ok := p.actions[evt.Key()]; ok {
|
||||
a.Action(evt)
|
||||
|
|
|
|||
Loading…
Reference in New Issue