]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-134953: Expand theming for `True`/`False`/`None` (#135000)
authorStan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Mon, 15 Sep 2025 14:36:17 +0000 (15:36 +0100)
committerGitHub <noreply@github.com>
Mon, 15 Sep 2025 14:36:17 +0000 (16:36 +0200)
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Lib/_colorize.py
Lib/_pyrepl/utils.py
Misc/NEWS.d/next/Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst [new file with mode: 0644]

index 325efed274aed75e413e0f1385420476dbdfadf1..f45e7b8bb300f1f0699c28f640e75e2c7c97ea43 100644 (file)
@@ -187,6 +187,7 @@ class Difflib(ThemeSection):
 class Syntax(ThemeSection):
     prompt: str = ANSIColors.BOLD_MAGENTA
     keyword: str = ANSIColors.BOLD_BLUE
+    keyword_constant: str = ANSIColors.BOLD_BLUE
     builtin: str = ANSIColors.CYAN
     comment: str = ANSIColors.RED
     string: str = ANSIColors.GREEN
index c5d006afa7731fa87118825a2f389b114a742777..d32fce591fadcc2d3be568f0f5836120442ec031 100644 (file)
@@ -196,6 +196,9 @@ def gen_colors_from_token_stream(
                     is_def_name = False
                     span = Span.from_token(token, line_lengths)
                     yield ColorSpan(span, "definition")
+                elif token.string in ("True", "False", "None"):
+                    span = Span.from_token(token, line_lengths)
+                    yield ColorSpan(span, "keyword_constant")
                 elif keyword.iskeyword(token.string):
                     span = Span.from_token(token, line_lengths)
                     yield ColorSpan(span, "keyword")
diff --git a/Misc/NEWS.d/next/Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst b/Misc/NEWS.d/next/Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst
new file mode 100644 (file)
index 0000000..c2f112d
--- /dev/null
@@ -0,0 +1,2 @@
+Expand ``_colorize`` theme with ``keyword_constant`` and implement in
+:term:`repl`.