How to customize option and command name colors in --help? #660
Unanswered
malici0us-link
asked this question in
Questions
Replies: 2 comments 2 replies
-
@malici0us-link any updates on this? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I wanted to change the color of the type hinting / ranges, as yellow was too intrusive, I did it doing the following: import typer.rich_utils
# Note: Must be `module.var = "Value"`, as `from typer.rich_utils import STYLE_METAVAR`
# copies the variable definition to this local file and doesn't change values upstream
typer.rich_utils.STYLE_METAVAR = "dim"
# (...) There's a lot of color constants defined there, go for some trial and error, should do it :) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
How do you change the color of options and commands in --help? By default they are both a bright blue. Also, if you are using a boolean option, the negative boolean "--no-example" is purple. How can I change these bright blue and purple colors? I tried the code snippet I've attached here, but that doesn't seem to work. As you can see, in the code snippet, Rich syntax works for the help parameter (
[red]global top-level option[/red]
andred]another global top-level option[/red]
work) and the epilog (the heart turns green), but it doesn't work when declaring the name of your option.Operating System
macOS
Operating System Details
No response
Typer Version
0.9.0
Python Version
3.11.4
Additional Context
Beta Was this translation helpful? Give feedback.
All reactions