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