From faf511f0c713a658f0584615b9b0764534fb7c04 Mon Sep 17 00:00:00 2001 From: Alex Waite Date: Sun, 8 Dec 2024 18:07:24 +0100 Subject: [PATCH] don't override terminal foreground color for pygments themes Styles without a color should not hardcode to black, and instead use None, which instructs Pygments to use the terminal's configured foreground color. --- rich/syntax.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rich/syntax.py b/rich/syntax.py index cff8fd235..246a19acd 100644 --- a/rich/syntax.py +++ b/rich/syntax.py @@ -162,7 +162,7 @@ def get_style_for_token(self, token_type: TokenType) -> Style: color = pygments_style["color"] bgcolor = pygments_style["bgcolor"] style = Style( - color="#" + color if color else "#000000", + color="#" + color if color else None, bgcolor="#" + bgcolor if bgcolor else self._background_color, bold=pygments_style["bold"], italic=pygments_style["italic"],