Skip to content

Add colour to defaults in argparse help #141679

Closed

Description

@hugovk

Feature or enhancement

Proposal:

argparse help is in colour in Python 3.14:

Image

The defaults are also in the same plaintext as the main help, but some other CLIs use another colour.

Typer defaults are light grey:

Image

Composer defaults are yellow:

Image

For argparse, I suggest having "(default: " and ")" in grey, as they're not so important (and always the same). And the default value itself in (non-bold) yellow, to mirror the (bold) yellow of the label, where the default is sort of slotting into. For example, "pretty" is the default format, and the other choices are also in yellow:

Image

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added
    type-featureA feature request or enhancement
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 17, 2025
  2. serhiy-storchaka commented on Nov 18, 2025

    @serhiy-storchaka
    Member

    Would not using too much colors distract and make it hard to read?

    Some programs that use argparse include "(default: ...)" with literal description in the argument help. Some programs use %(default)s in the argument help. Now they will be different from the generated ones.

  3. added a commit that references this issue on Nov 23, 2025
  4. alexprengere commented on Nov 23, 2025

    @alexprengere
    Contributor

    I think this is a great addition!

    As someone who use %(default)s a lot to describe options, I would be glad to have similar colors applied when interpolating such variables. I can open another issue to that effect, and probably work on a PR, if this seems like a good idea.

  5. moved this from Doc issues to Done in Argparse issueson Dec 6, 2025
  6. added a commit that references this issue on Dec 6, 2025
  7. added a commit that references this issue on Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions