Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.

Icon format #222

Merged
merged 8 commits into from
Jun 4, 2019
Merged

Icon format #222

merged 8 commits into from
Jun 4, 2019

Conversation

AlecAivazis
Copy link
Owner

@AlecAivazis AlecAivazis commented Jun 4, 2019

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

Copy link
Collaborator

@coryb coryb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, looks good to me.

@AlecAivazis AlecAivazis merged commit 34c84b5 into master Jun 4, 2019
@AlecAivazis AlecAivazis deleted the icon-format branch June 4, 2019 21:50
siredmar pushed a commit to siredmar/survey that referenced this pull request Feb 20, 2020
* added icon struct

* added format strings to templates

* documented icon formats

* fixed typo in icon format documentation

* grammar is hard

* so is formatting

* removed duplicative wording in docs

* added default format to docs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for changing the color of the different runes/prompts
2 participants