🐛 Fix setting FORCE_TERMINAL with colors (#423)

This commit is contained in:
Sebastián Ramírez 2022-07-12 22:17:00 +02:00 committed by GitHub
parent b0c2647a01
commit f6626c8cf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,12 +71,17 @@ COLOR_SYSTEM: Optional[
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) "