Skip to content

Commit 77d64e4

Browse files
committed
docs: try to fix colors
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 90ec5b7 commit 77d64e4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ def subprocess_run(*args: str) -> str:
1919
env.pop("NO_COLOR", None)
2020
env["PATH"] = f"{scripts}{os.pathsep}{env.get('PATH', '')}"
2121
env["PYTHON_COLORS"] = "1"
22+
env["FORCE_COLORS"] = "1"
2223
output = subprocess.run(args, check=True, capture_output=True, text=True, env=env).stdout
2324
rich_text = rich.text.Text.from_ansi(output)
24-
console = rich.console.Console(record=True)
25+
console = rich.console.Console(record=True, force_terminal=True)
2526
console.print(rich_text)
2627
page = console.export_html(inline_styles=True)
27-
text = re.search(r"<body.*?>(.*?)</body>", page, re.DOTALL | re.IGNORECASE).group(1)
28-
return text.strip()
28+
result = re.search(r"<body.*?>(.*?)</body>", page, re.DOTALL | re.IGNORECASE)
29+
assert result
30+
return result.group(1).strip()

0 commit comments

Comments
 (0)