1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #104524 from wheatear-dev/disable-colors-doc-option

Support a `NO_COLOR` environment variable in `doc_status.py`
This commit is contained in:
Thaddeus Crews
2025-03-25 11:09:12 -05:00
2 changed files with 4 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ from typing import Dict, List, Set
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../"))
from misc.utility.color import STDOUT_COLOR, Ansi, toggle_color
from misc.utility.color import NO_COLOR, STDOUT_COLOR, Ansi, toggle_color
################################################################################
# Config #
@@ -114,6 +114,8 @@ def validate_tag(elem: ET.Element, tag: str) -> None:
def color(color: str, string: str) -> str:
if NO_COLOR:
return string
color_format = "".join([str(x) for x in colors[color]])
return f"{color_format}{string}{Ansi.RESET}"

View File

@@ -9,6 +9,7 @@ from typing import Final
# to a file, it won't contain color codes. Colors are always enabled on continuous integration.
IS_CI: Final[bool] = bool(os.environ.get("CI"))
NO_COLOR: Final[bool] = bool(os.environ.get("NO_COLOR"))
STDOUT_TTY: Final[bool] = bool(sys.stdout.isatty())
STDERR_TTY: Final[bool] = bool(sys.stderr.isatty())