Skip to content

✨ Allow custom styles for commands in help output#1103

Merged
tiangolo merged 2 commits intofastapi:masterfrom
TheTechromancer:master
Feb 27, 2025
Merged

✨ Allow custom styles for commands in help output#1103
tiangolo merged 2 commits intofastapi:masterfrom
TheTechromancer:master

Conversation

@TheTechromancer
Copy link
Copy Markdown
Contributor

@TheTechromancer TheTechromancer commented Dec 31, 2024

This PR makes a small tweak to the command highlighting in help output to use the global STYLE_OPTION instead of being hardcoded as bold cyan:

image

This allows users to more easily customize colors in their help output.

By default, this has no effect since the default STYLE_OPTION is already bold cyan.

@svlandeg svlandeg changed the title Allow custom styles for commands in help output ✨ Allow custom styles for commands in help output Jan 2, 2025
@svlandeg svlandeg added the feature New feature, enhancement or request label Jan 2, 2025
Copy link
Copy Markdown
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!
Good catch - that style shouldn't be hardcoded like this.

We could indeed reuse STYLE_OPTION as you propose, but that would mean that the color of this first column would always be the same as the style chosen for the console's "option" theme. I think these may also be separate things?

So basically I think we could take this one step further and define a new var, something like STYLE_COMMANDS_TABLE_FIRST_COLUMN and set that to "bold cyan" to default? What do you think?

@svlandeg svlandeg self-assigned this Jan 2, 2025
@TheTechromancer
Copy link
Copy Markdown
Contributor Author

Sounds good @svlandeg, I made the change.

Copy link
Copy Markdown
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

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

Look good to me! I'll leave this for Tiangolo to merge.

@svlandeg svlandeg removed their assignment Jan 8, 2025
Copy link
Copy Markdown
Member

@tiangolo tiangolo left a comment

Choose a reason for hiding this comment

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

Makes sense, thank you! 🚀

@tiangolo tiangolo merged commit e8096c9 into fastapi:master Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature, enhancement or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants