From 0602b6911c87298089f5fdb75e1fc856a4649519 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sun, 1 Jun 2025 11:16:00 +0100 Subject: [PATCH] Expand theme --- Lib/_colorize.py | 1 + Lib/_pyrepl/utils.py | 3 +++ .../Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst | 2 ++ 3 files changed, 6 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst diff --git a/Lib/_colorize.py b/Lib/_colorize.py index 4a310a402358b6..7c09bb4564c2e0 100644 --- a/Lib/_colorize.py +++ b/Lib/_colorize.py @@ -176,6 +176,7 @@ class Argparse(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 diff --git a/Lib/_pyrepl/utils.py b/Lib/_pyrepl/utils.py index e04fbdc6c8a5c4..0b64c0f2f8b664 100644 --- a/Lib/_pyrepl/utils.py +++ b/Lib/_pyrepl/utils.py @@ -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 index 00000000000000..622c847c80a3cc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst @@ -0,0 +1,2 @@ +Expand ``_colorize`` theme with ``keyword_colorize`` and implement in +:term:`repl`.