Skip to content

Commit a5b9d0b

Browse files
gh-134953: Expand theming for True/False/None (#135000)
Co-authored-by: Łukasz Langa <[email protected]>
1 parent 67cc1cf commit a5b9d0b

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

Lib/_colorize.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ class Difflib(ThemeSection):
187187
class Syntax(ThemeSection):
188188
prompt: str = ANSIColors.BOLD_MAGENTA
189189
keyword: str = ANSIColors.BOLD_BLUE
190+
keyword_constant: str = ANSIColors.BOLD_BLUE
190191
builtin: str = ANSIColors.CYAN
191192
comment: str = ANSIColors.RED
192193
string: str = ANSIColors.GREEN

Lib/_pyrepl/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ def gen_colors_from_token_stream(
196196
is_def_name = False
197197
span = Span.from_token(token, line_lengths)
198198
yield ColorSpan(span, "definition")
199+
elif token.string in ("True", "False", "None"):
200+
span = Span.from_token(token, line_lengths)
201+
yield ColorSpan(span, "keyword_constant")
199202
elif keyword.iskeyword(token.string):
200203
span = Span.from_token(token, line_lengths)
201204
yield ColorSpan(span, "keyword")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Expand ``_colorize`` theme with ``keyword_constant`` and implement in
2+
:term:`repl`.

0 commit comments

Comments
 (0)