Skip to content

Conversation

@kotazzz
Copy link

@kotazzz kotazzz commented Aug 28, 2025

What is the problem that this PR addresses?
Currently, the message parameter of questionary.select() only accepts plain strings and does not support formatted text (e.g., ANSI or Rich styles).
This makes it impossible to style the prompt title, even though option titles (choices) already support formatting via FormattedText.

Closes #449
Related to #107

How did you solve it?
I extended the logic in select() so that the message parameter now accepts FormattedText (including objects with __pt_formatted_text__ or lists of style/text tuples).
If a formatted message is provided, it is rendered with all styles and colors preserved, just like for option titles.
This was tested with both manual ANSI codes and Rich → PromptToolkit conversions to confirm correct rendering.

Checklist

  • I have read the Contributor's Guide.
  • I have checked that all automated PR checks pass before requesting review.

@kotazzz
Copy link
Author

kotazzz commented Aug 28, 2025

@tmbo Hi! This PR fixes #449. Could you take a look when you have a chance?

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.

ANSI colours and formatting not applied to Questionary prompt title

1 participant