Skip to content

Commit c27da53

Browse files
committed
Change the pterm colors to survey
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
1 parent 832907e commit c27da53

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

pkg/uiutil/uiutil.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,22 @@ var (
1717
InterruptErr = ErrInterrupt // deprecated
1818
)
1919

20+
// use the same colors as the previous "survey/v2".
21+
var (
22+
primaryStyle = pterm.Style{pterm.FgDefault}
23+
secondaryStyle = pterm.Style{pterm.FgCyan}
24+
)
25+
2026
// Confirm is a regular text input that accept yes/no answers.
2127
func Confirm(message string, defaultParam bool) (bool, error) {
2228
var ans bool
2329
var err error
30+
interactiveConfirm := pterm.DefaultInteractiveConfirm
31+
// override the default theme colors (cyan/magenta)
32+
interactiveConfirm.TextStyle = &primaryStyle
33+
interactiveConfirm.SuffixStyle = &secondaryStyle
2434
interrupted := false
25-
prompt := pterm.DefaultInteractiveConfirm.
35+
prompt := interactiveConfirm.
2636
WithDefaultText(message).
2737
WithDefaultValue(defaultParam).
2838
WithOnInterruptFunc(func() {
@@ -43,8 +53,12 @@ func Select(message string, options []string) (int, error) {
4353
var ans int
4454
var sel string
4555
var err error
56+
interactiveSelect := pterm.DefaultInteractiveSelect
57+
// override the default theme colors (cyan/magenta)
58+
interactiveSelect.TextStyle = &primaryStyle
59+
interactiveSelect.SelectorStyle = &secondaryStyle
4660
interrupted := false
47-
prompt := pterm.DefaultInteractiveSelect.
61+
prompt := interactiveSelect.
4862
WithDefaultText(message).
4963
WithOptions(options).
5064
WithOnInterruptFunc(func() {

0 commit comments

Comments
 (0)