Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional styling #14

Merged
merged 12 commits into from Aug 25, 2019
Merged

Conversation

CrazyIvan359
Copy link
Contributor

This PR adds a several new methods of styling the select and checkbox prompts

  • Add flag to disable drawing of the pointer character
  • Add highlighted token to style the choice being pointed to
    • This style will only be applied when use_pointer is False
  • Add text token to style ordinary text
  • Add disabled token to style disabled choices
  • Disabled value is no longer displayed if it is a bool
  • Choice titles can now be a list of token tuples to support custom styling
    • The answer displayed after the prompt is closed will use the answer token
    • This type of styling means that selected and highlighted tokens will have no effect

I originally thought that use_indicator would serve the same purpose as use_pointer in this PR, but for select it turns on the checkbox style checkbox symbol. I suggest removing this option from the select prompt as well, but I wanted to discuss before making that change.

use_indicator: Flag to enable the small indicator in front of the
list highlighting the current location of the selection
cursor.

This PR supersedes #12 and #13

Signed-off-by: Michael Murton <6764025+CrazyIvan359@users.noreply.github.com>
Signed-off-by: Michael Murton <6764025+CrazyIvan359@users.noreply.github.com>
Signed-off-by: Michael Murton <6764025+CrazyIvan359@users.noreply.github.com>
Signed-off-by: Michael Murton <6764025+CrazyIvan359@users.noreply.github.com>
Signed-off-by: Michael Murton <6764025+CrazyIvan359@users.noreply.github.com>
Signed-off-by: Michael Murton <6764025+CrazyIvan359@users.noreply.github.com>
Signed-off-by: Michael Murton <6764025+CrazyIvan359@users.noreply.github.com>
@tmbo
Copy link
Owner

tmbo commented Aug 19, 2019

@CrazyIvan359 sorry I missed this, was on vacation and there were to many github notifications.

Great PR! Before I can merge it we need some docs on the additional options. Can you please adapt the readme (e.g. adding the additional styling keys to the list)?

@CrazyIvan359
Copy link
Contributor Author

No problem, hope it was a good one.

I will get some docs added as soon as I can.

What are your thoughts on removing use_indicator for the select dialog?

@tmbo
Copy link
Owner

tmbo commented Aug 23, 2019

Mhm I don't think we should remove it as it serves a different purpose than the flag you are proposing. The naming might not be ideal, but I think we should keep both

@CrazyIvan359
Copy link
Contributor Author

Alright, I'll leave it in. I should have some time this weekend to write up some docs.

@tmbo
Copy link
Owner

tmbo commented Aug 23, 2019

sounds awesome 🚀

@CrazyIvan359
Copy link
Contributor Author

Docs added!
Caught an oversight because I wasn't using it. Choice now concats all text from title tokens to use as value instead of the list itself.
Also added a couple of tests.

Copy link
Owner

@tmbo tmbo left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the additional tests and the documentation - looks great 🚀

@tmbo tmbo merged commit f0e8ce6 into tmbo:master Aug 25, 2019
@tmbo
Copy link
Owner

tmbo commented Aug 25, 2019

feature is released as part of version 1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants