AlecAivazis / survey

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

Icon format #222

Closed AlecAivazis closed 5 years ago

AlecAivazis commented 5 years ago

This PR changes our handling of icons from a String to a struct with Format and Text. This lets the WithIcon option be used to change the color and formatting of the icon. I considered an API like what was suggested in #193 however since it would force the user to always set the color even if they just wanted to change the icon, I decided it was too cumbersome to use.

example:

survey.AskOne(prompt, &number, survey.WithIcons(function(icons *survey.IconSet) {
    icons.Question.Text = "??"
    icons.Question.Format = "yellow+hb"
}))

Fixes #141