AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.09k stars 352 forks source link

Modify prompt text color #298

Open droctothorpe opened 4 years ago

droctothorpe commented 4 years ago

Is there a way to modify the Select question prompt text color?

I see https://github.com/AlecAivazis/survey/blob/9f0147aa9ef6a6810ebb976da58f2c331a96b5a9/select.go#L48 but I'm not entirely sure what to do with it. An example would be really helpful.

Thank you!

PS. This library is amazing and I sing it's praises to all the Golang devs I know who are willing to listen. Thank you for all of the hard work that you put into it.

droctothorpe commented 4 years ago

NVM! Figured this out. Might be worth changing this heading:

https://github.com/AlecAivazis/survey/blob/863da4d0600f0b2e969352c91a808e5bc94e220d/README.md#changing-the-icons

to Changing the Icons and Prompt Text Color or something to that effect.

droctothorpe commented 4 years ago

Hm not seeing a way to modify the default help text Use arrows to move, type to filter color though: image

That could be a good thing to make configurable.

AlecAivazis commented 4 years ago

Oh! I'm not sure how I missed this issue. I'm sorry for not responding sooner and thank you for the kind words!

I think supporting that level of modifcation is probably too-fine grained for my personal use but I dont really mind adding yet another field to an IconSet for the default color. "IconSet" doesn't really fit anymore, but oh well it's not worth breaking the API for something so small

kennyngdev commented 3 years ago

Hi! I just made the PR according to this issue. Now you can change the help text color like this in select:

color := ""
prompt := &survey.Select{
    Message: "Choose a color:",
    Options: []string{"red", "blue", "green"},
    HelpTextColor: "red",

}
survey.AskOne(prompt, &color)

Do you guys want me to expand it to other prompts?