From f6626c8cf4f0960d593b1d654884317ee36e173a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 12 Jul 2022 22:17:00 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20setting=20`FORCE=5FTERMINA?= =?UTF-8?q?L`=20with=20colors=20(#423)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typer/rich_utils.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/typer/rich_utils.py b/typer/rich_utils.py index bcaa4fd..69a0bdd 100644 --- a/typer/rich_utils.py +++ b/typer/rich_utils.py @@ -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) "