https://github.com/python/cpython/commit/a5b9d0b8b273eaf7cfee8bb5770449b2e4395993 commit: a5b9d0b8b273eaf7cfee8bb5770449b2e4395993 branch: main author: Stan Ulbrych <[email protected]> committer: ambv <[email protected]> date: 2025-09-15T16:36:17+02:00 summary:
gh-134953: Expand theming for `True`/`False`/`None` (#135000) Co-authored-by: Ćukasz Langa <[email protected]> files: A Misc/NEWS.d/next/Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst M Lib/_colorize.py M Lib/_pyrepl/utils.py diff --git a/Lib/_colorize.py b/Lib/_colorize.py index 325efed274aed7..f45e7b8bb300f1 100644 --- a/Lib/_colorize.py +++ b/Lib/_colorize.py @@ -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 diff --git a/Lib/_pyrepl/utils.py b/Lib/_pyrepl/utils.py index c5d006afa7731f..d32fce591fadcc 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..c2f112dc62cea8 --- /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_constant`` and implement in +:term:`repl`. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
