Skip to content

Commit dc4d016

Browse files
miss-islingtonStanFromIrelandambv
authored
[3.14] pythongh-134953: Expand theming for True/False/None (pythonGH-135000) (python#138928)
Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Łukasz Langa <[email protected]>
1 parent 19a8670 commit dc4d016

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
@@ -176,6 +176,7 @@ class Argparse(ThemeSection):
176176
class Syntax(ThemeSection):
177177
prompt: str = ANSIColors.BOLD_MAGENTA
178178
keyword: str = ANSIColors.BOLD_BLUE
179+
keyword_constant: str = ANSIColors.BOLD_BLUE
179180
builtin: str = ANSIColors.CYAN
180181
comment: str = ANSIColors.RED
181182
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)