Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add colour config for container picker #2140

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions internal/config/styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ type (
Xray Xray `yaml:"xray"`
Charts Charts `yaml:"charts"`
Yaml Yaml `yaml:"yaml"`
Picker Picker `yaml:"picker"`
Log Log `yaml:"logs"`
}

Expand All @@ -119,6 +120,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"`
Expand Down Expand Up @@ -310,6 +318,7 @@ func newViews() Views {
Xray: newXray(),
Charts: newCharts(),
Yaml: newYaml(),
Picker: newPicker(),
Log: newLog(),
}
}
Expand Down Expand Up @@ -359,6 +368,14 @@ func newStatus() Status {
}
}

func newPicker() Picker {
return Picker{
MainColor: "white",
FocusColor: "aqua",
ShortcutColor: "aqua",
}
}

func newLog() Log {
return Log{
FgColor: "lightskyblue",
Expand Down
9 changes: 6 additions & 3 deletions internal/view/picker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down