Skip to content

Commit

Permalink
馃悰 Fix setting FORCE_TERMINAL with colors (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Jul 12, 2022
1 parent b0c2647 commit f6626c8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions typer/rich_utils.py
Expand Up @@ -71,12 +71,17 @@
Literal["auto", "standard", "256", "truecolor", "windows"]
] = "auto" # Set to None to disable colors
_TYPER_FORCE_DISABLE_TERMINAL = getenv("_TYPER_FORCE_DISABLE_TERMINAL")
FORCE_TERMINAL = bool(
not _TYPER_FORCE_DISABLE_TERMINAL
and getenv("GITHUB_ACTIONS")
or getenv("FORCE_COLOR")
or getenv("PY_COLORS")
FORCE_TERMINAL = (
True
if getenv("GITHUB_ACTIONS") or getenv("FORCE_COLOR") or getenv("PY_COLORS")
else None
)
if _TYPER_FORCE_DISABLE_TERMINAL:
FORCE_TERMINAL = False

print(FORCE_TERMINAL)

print(FORCE_TERMINAL)

# Fixed strings
DEPRECATED_STRING = "(deprecated) "
Expand Down

0 comments on commit f6626c8

Please sign in to comment.