-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Description
Feature or enhancement
Proposal:
I made a custom _colorize theme to try making my REPL syntax highlighting look similar to my text editor's.
This is the theme I used:
theme_with_dim_operators = default_theme.copy_with(
syntax=Syntax(
keyword=ANSIColors.GREEN,
builtin=ANSIColors.BLUE,
comment=ANSIColors.INTENSE_YELLOW,
string=ANSIColors.CYAN,
number=ANSIColors.CYAN,
definition=ANSIColors.BLUE,
soft_keyword=ANSIColors.BOLD_GREEN,
),
)I then used this example code to check the highlighting between the two:
from math import pi
print(f"Welcome to Python {pi:.2f}")
name = None
if name is None:
print("It's", True)Pasting that code in my text editor (vim), looks like this:
Pasting the same code in the REPL, looks like this:
The granularity with syntax highlighting needs to stop somewhere, but I feel it would be nice to add a bit more granularity than is currently supported by _colorize.
In particular, it would be nice to distinguish between:
- Syntax keywords in general (
if,is,def,for,with, etc.) - Keywords that are variables (
True,False,None) - Imports in particular (
from,import)
I feel that distinguishing between 1 and 2 is more important than between 1 and 3. While None is a keyword, seeing it appear in the same color as is and other keywords feels odd.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response

