diff --git a/internal/config/styles.go b/internal/config/styles.go index 86861b25..649da3eb 100644 --- a/internal/config/styles.go +++ b/internal/config/styles.go @@ -35,6 +35,7 @@ type ( // Style tracks K9s styles. Style struct { Body Body `yaml:"body"` + Prompt Prompt `yaml:"prompt"` Help Help `yaml:"help"` Frame Frame `yaml:"frame"` Info Info `yaml:"info"` @@ -42,6 +43,13 @@ type ( Dialog Dialog `yaml:"dialog"` } + // Prompt tracks command styles + Prompt struct { + FgColor Color `yaml:"fgColor"` + BgColor Color `yaml:"bgColor"` + SuggestColor Color `yaml:"suggestColor"` + } + // Help tracks help styles. Help struct { FgColor Color `yaml:"fgColor"` @@ -246,6 +254,7 @@ func (c Colors) Colors() []tcell.Color { func newStyle() Style { return Style{ Body: newBody(), + Prompt: newPrompt(), Help: newHelp(), Frame: newFrame(), Info: newInfo(), @@ -267,6 +276,14 @@ func newDialog() Dialog { } } +func newPrompt() Prompt { + return Prompt{ + FgColor: "cadetBlue", + BgColor: "black", + SuggestColor: "dodgerblue", + } +} + func newCharts() Charts { return Charts{ BgColor: "black", diff --git a/internal/ui/prompt.go b/internal/ui/prompt.go index cdd4ace4..32340431 100644 --- a/internal/ui/prompt.go +++ b/internal/ui/prompt.go @@ -94,8 +94,8 @@ func NewPrompt(noIcons bool, styles *config.Styles) *Prompt { p.SetDynamicColors(true) p.SetBorder(true) p.SetBorderPadding(0, 0, 1, 1) - p.SetBackgroundColor(styles.BgColor()) - p.SetTextColor(styles.FgColor()) + p.SetBackgroundColor(styles.K9s.Prompt.BgColor.Color()) + p.SetTextColor(styles.K9s.Prompt.FgColor.Color()) styles.AddListener(&p) p.SetInputCapture(p.keyboard) @@ -164,8 +164,8 @@ func (p *Prompt) keyboard(evt *tcell.EventKey) *tcell.EventKey { // StylesChanged notifies skin changed. func (p *Prompt) StylesChanged(s *config.Styles) { p.styles = s - p.SetBackgroundColor(s.BgColor()) - p.SetTextColor(s.FgColor()) + p.SetBackgroundColor(s.K9s.Prompt.BgColor.Color()) + p.SetTextColor(s.K9s.Prompt.FgColor.Color()) } // InCmdMode returns true if command is active, false otherwise. @@ -196,7 +196,7 @@ func (p *Prompt) write(text, suggest string) { p.SetCursorIndex(p.spacer + len(text)) txt := text if suggest != "" { - txt += "[dodgerblue::-]" + suggest + txt += fmt.Sprintf("[%s::-]%s", p.styles.K9s.Prompt.SuggestColor, suggest) } fmt.Fprintf(p, defaultPrompt, p.icon, txt) } diff --git a/skins/axual.yml b/skins/axual.yml index d58dc015..d8d48d11 100644 --- a/skins/axual.yml +++ b/skins/axual.yml @@ -1,11 +1,11 @@ # Axual Skin contributed by [@JayKus](jimmy@axual.com) # Style -blue: &blue '#113851' -red: &red '#D7595F' -yellow: &yellow '#F2BF40' -cyan: &cyan '#47B0AB' -grey: &grey '#A99688' -light: &light '#F1EFE4' +blue: &blue "#113851" +red: &red "#D7595F" +yellow: &yellow "#F2BF40" +cyan: &cyan "#47B0AB" +grey: &grey "#A99688" +light: &light "#F1EFE4" # Skin k9s: @@ -13,7 +13,13 @@ k9s: body: fgColor: *yellow bgColor: *blue - logoColor: 'orange' + logoColor: orange + + # Command prompt styles + prompt: + fgColor: *yellow + bgColor: *blue + suggestColor: orange # ClusterInfoView styles info: @@ -67,7 +73,7 @@ k9s: bgColor: *blue highlightColor: *cyan counterColor: *light - filterColor: 'slategray' + filterColor: "slategray" # Specific views styles views: # TableView attributes. @@ -79,7 +85,7 @@ k9s: header: fgColor: *light bgColor: *blue - sorterColor: 'orange' + sorterColor: "orange" # Xray style xray: diff --git a/skins/black_and_wtf.yml b/skins/black_and_wtf.yml index e98ac68f..281ffacf 100644 --- a/skins/black_and_wtf.yml +++ b/skins/black_and_wtf.yml @@ -17,6 +17,10 @@ k9s: fgColor: *fg bgColor: *bg logoColor: *fg + prompt: + fgColor: *fg + bgColor: *bg + suggestColor: &gray info: fgColor: *text sectionColor: *fg diff --git a/skins/dracula.yml b/skins/dracula.yml index 09b03303..38d63278 100644 --- a/skins/dracula.yml +++ b/skins/dracula.yml @@ -19,6 +19,11 @@ k9s: fgColor: *foreground bgColor: *background logoColor: *purple + # Command prompt styles + prompt: + fgColor: *foreground + bgColor: *background + suggestColor: *purple # ClusterInfoView styles. info: fgColor: *pink diff --git a/skins/gruvbox-dark.yml b/skins/gruvbox-dark.yml index 7eaf5969..1088e31b 100644 --- a/skins/gruvbox-dark.yml +++ b/skins/gruvbox-dark.yml @@ -16,6 +16,10 @@ k9s: fgColor: *foreground bgColor: *background logoColor: *blue + prompt: + fgColor: *foreground + bgColor: *background + suggestColor: *orange info: fgColor: *magenta sectionColor: *foreground diff --git a/skins/gruvbox-light.yml b/skins/gruvbox-light.yml index c982bfd2..15e38a4a 100644 --- a/skins/gruvbox-light.yml +++ b/skins/gruvbox-light.yml @@ -16,6 +16,10 @@ k9s: fgColor: *foreground bgColor: *background logoColor: *blue + prompt: + fgColor: *foreground + bgColor: *background + suggestColor: *orange info: fgColor: *magenta sectionColor: *foreground diff --git a/skins/in_the_navy.yml b/skins/in_the_navy.yml index 3f5ee347..552291de 100644 --- a/skins/in_the_navy.yml +++ b/skins/in_the_navy.yml @@ -23,6 +23,10 @@ k9s: fgColor: *fg bgColor: *bg logoColor: *blue + prompt: + fgColor: *fg + bgColor: *bg + suggestColor: *cadet info: fgColor: *sky sectionColor: *steel diff --git a/skins/kiss.yml b/skins/kiss.yml index 6593f3ef..c65829c4 100644 --- a/skins/kiss.yml +++ b/skins/kiss.yml @@ -4,6 +4,10 @@ k9s: fgColor: default bgColor: default logoColor: default + prompt: + fgColor: default + bgColor: default + suggestColor: default info: fgColor: default sectionColor: default diff --git a/skins/monokai.yml b/skins/monokai.yml index 6c77268f..04605bc6 100644 --- a/skins/monokai.yml +++ b/skins/monokai.yml @@ -18,6 +18,11 @@ k9s: fgColor: *foreground bgColor: *background logoColor: *magenta + # Command prompt styles + prompt: + fgColor: *foreground + bgColor: *background + suggestColor: *orange # ClusterInfoView styles. info: fgColor: *blue @@ -94,7 +99,7 @@ k9s: - *magenta v1/pods: - *blue - - *magenta + - *magenta # TableView attributes. table: fgColor: *foreground diff --git a/skins/nord.yml b/skins/nord.yml index 1076ce18..d481159d 100644 --- a/skins/nord.yml +++ b/skins/nord.yml @@ -17,6 +17,11 @@ k9s: fgColor: *foreground bgColor: default logoColor: *magenta + # Command prompt styles + prompt: + fgColor: *foreground + bgColor: *background + suggestColor: *orange # ClusterInfoView styles. info: fgColor: *blue diff --git a/skins/one_dark.yml b/skins/one_dark.yml index 67c3f7e4..564aab49 100644 --- a/skins/one_dark.yml +++ b/skins/one_dark.yml @@ -16,6 +16,10 @@ k9s: fgColor: *foreground bgColor: *background logoColor: *green + prompt: + fgColor: *foreground + bgColor: *background + suggestColor: *orange info: fgColor: *grey sectionColor: *green diff --git a/skins/snazzy.yml b/skins/snazzy.yml index ebd3ff91..b101007a 100644 --- a/skins/snazzy.yml +++ b/skins/snazzy.yml @@ -3,6 +3,10 @@ k9s: fgColor: "#97979b" bgColor: "#282a36" logoColor: "#5af78e" + prompt: + fgColor: "#97979b" + bgColor: "#282a36" + suggestColor: "#5af78e" info: fgColor: white sectionColor: "#5af78e" diff --git a/skins/solarized_dark.yml b/skins/solarized_dark.yml index 11b5ed07..0f7d4e4d 100644 --- a/skins/solarized_dark.yml +++ b/skins/solarized_dark.yml @@ -16,6 +16,10 @@ k9s: fgColor: *foreground bgColor: *background logoColor: *blue + prompt: + fgColor: *foreground + bgColor: *background + suggestColor: *orange info: fgColor: *magenta sectionColor: *foreground diff --git a/skins/solarized_light.yml b/skins/solarized_light.yml index f7241f8b..008fc4b1 100644 --- a/skins/solarized_light.yml +++ b/skins/solarized_light.yml @@ -17,6 +17,10 @@ k9s: fgColor: *foreground bgColor: *background logoColor: *blue + prompt: + fgColor: *foreground + bgColor: *background + suggestColor: *orange info: fgColor: *magenta sectionColor: *foreground diff --git a/skins/stock.yml b/skins/stock.yml index 0133a120..c9db8f3a 100644 --- a/skins/stock.yml +++ b/skins/stock.yml @@ -3,6 +3,10 @@ k9s: fgColor: dodgerblue bgColor: black logoColor: orange + prompt: + fgColor: cadetblue + bgColor: black + suggestColor: dodgerblue info: fgColor: white sectionColor: dodgerblue