Skip to content

Add module docstring to colors module#1476

Open
Mohamed-Elwasila wants to merge 2 commits intofastapi:masterfrom
Mohamed-Elwasila:add-colors-module-docstring
Open

Add module docstring to colors module#1476
Mohamed-Elwasila wants to merge 2 commits intofastapi:masterfrom
Mohamed-Elwasila:add-colors-module-docstring

Conversation

@Mohamed-Elwasila
Copy link

Summary

Adds a module-level docstring to typer/colors.py to document its purpose and usage.

Changes

  • Added module docstring explaining color constants for terminal styling
  • Included usage examples with typer.style() and typer.secho()

The colors module previously only had a comment. This adds proper documentation that will show up in IDE tooltips and generated docs.

@svlandeg svlandeg added the docs Improvements or additions to documentation label Jan 6, 2026
@derOtto
Copy link

derOtto commented Feb 7, 2026

Hi @Mohamed-Elwasila,

thanks a lot for your contribution!

I'm not sure if this change really helps users when working with Typer.
There are already many different ways to print text with colors, and I was also confused myself about which colors I can use in which situation (using rich.print, typer.echo, typer.secho, typer.style).

Because of that, would it maybe be better to improve the documentation here: https://typer.tiangolo.com/tutorial/printing/
For example, by explaining more clearly how and which colors can be used for each of the different printing options?

I found these links for the two approaches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants