From 8c5b4bce1da86a8553c1f13eb76d0e711edc4e1e Mon Sep 17 00:00:00 2001 From: aarzilli Date: Thu, 25 Jan 2024 17:00:47 +0100 Subject: [PATCH] terminal: add prompt color option Add option to configure prompt color. Fixes #3603 --- pkg/config/config.go | 3 +++ pkg/terminal/terminal.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/pkg/config/config.go b/pkg/config/config.go index ac85f53213..5828776fd2 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -76,6 +76,9 @@ type Config struct { // Source list comment color, as a terminal escape sequence. SourceListCommentColor string `yaml:"source-list-comment-color"` + // Color for the prompt line. + PromptColor string `yaml:"prompt-color"` + // Source list tab color, as a terminal escape sequence. SourceListTabColor string `yaml:"source-list-tab-color"` diff --git a/pkg/terminal/terminal.go b/pkg/terminal/terminal.go index b9a4bfd2d5..11ca13f245 100644 --- a/pkg/terminal/terminal.go +++ b/pkg/terminal/terminal.go @@ -423,6 +423,10 @@ func (t *Term) formatPath(path string) string { } func (t *Term) promptForInput() (string, error) { + if t.stdout.colorEscapes != nil && t.conf.PromptColor != "" { + fmt.Fprint(os.Stdout, t.conf.PromptColor) + defer fmt.Fprint(os.Stdout, terminalResetEscapeCode) + } l, err := t.line.Prompt(t.prompt) if err != nil { return "", err