[QUESTION] How to force colorize output if using pager such as less #1316
-
First Check
Commit to Help
Example Codeimport typer
def main(name: str):
typer.echo(typer.style(f"Hello {name}", fg=typer.colors.GREEN))
if __name__ == "__main__":
typer.run(main)DescriptionHow to force colorize output if using pager such as command$ python main.py typer
Hello typerwith green color. $ poetry run python main.py typer | cat
Hello typerwith plain color. Can we tell typer force colorize output such as Operating SystemLinux Operating System DetailsNo response Typer Version0.4.0 Python VersionPython 3.10.1 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Answered by
robinbowes
Feb 3, 2022
Replies: 1 comment
-
|
typer.echo() is a wrapper around click.echo(), so you can use the same options. I think the |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
YuriiMotov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
typer.echo() is a wrapper around click.echo(), so you can use the same options.
I think the
colorparameter might be helpful. Default iscolor=Noneie. auto-detect. You should be able to passcolor=TrueI think.