Closed juxeii closed 1 year ago
Hi @juxeii , you can color and style options using rich syntax, it is partly demonstrated in the example. I have included the relevant excerpt extended with a bit more styling below.
names = [
"Frodo [bold]Baggins[/bold]",
"[#ff0000]Samwise Gamgee[/#ff0000]",
"Legolas",
"Aragorn",
"[blue]Sauron[/blue]",
]
name = select(names, cursor=">", cursor_style="cyan")
I am aware it requires a bit of manual work to massage the strings, but I would not really like to have tuples as I want to have beaupy
dead-simple.
Thanks, did not know that! Works nicely.
I have an issue with the colors in select_multiple
.
I color some options, for example:
The issue is that I cannot see the current active selection, which I specified with
cursor_style='green'
Now, when I do not color the options, like so:
The cursor style is now back and the users see the current selection.
Am I doing something wrong here? No matter which color I choose for the options, as soon as they are colored, I can no longer see the selection.
Thanks for reporting, this is a good catch. It's a trivial issue but I can't think of an elegant fix. Let me mull this over for a bit, I'll probably have it resolved during the weekend.
There is now a pre-release 3.5.3b0
that resolves this, also available on PyPI. Feel free to test around with your use-case and if everything works, I'll do a full release.
Hi, thx. Seems to work.
Released this as full release (3.5.3
) today.
Would it be possible to have an option for colors per entry in lets say multi-select? It would be perfect to show the user critical/important choices(e.g. in red). So, instead of just providing a list of options, would it be possible to provide a list of tuples, with first entry the text, second entry the color of the text? If no color is given, just use the default one.
Thx for this great module!