Code not changing colour has pointed this out, escape sequences within Python strings are not affected by the theme. After making a custom theme, switching the language to Python, and creating a string using an escape sequence, ex)
\n is not affected by the theme’s Regex color.
As @QwertyQwerty88 points out, this bug seems to affect some languages, Python included, so this should be a pretty simple fix if it works with other languages.
A suggestion if this does get fixed, the default Regex color should probably be a light pink or magenta, or at least some color that stands out from the default string color.
Here’s a screenshot of it working, btw:
And I think this may be a weird codemirror thing so I wonder if they can fix this
I remember this used to work, so I’d doubt CodeMirror would remove it for a couple of languages, but not all. Even if so, Replit is easily large enough to get CodeMirror’s attention to fix this, or Replit could even develop their own.
Here’s a screenshot of it failing to work in Python.
Apologies for the very high quality circles
Honestly I like the
\n being colored differently from the rest of the string as it makes code more readily readable imo
Yes, especially in long print statements. It will be much easier to identify a line break and edit from there.
I’m confused by this: are you assuming that
\n is a regular expression? (Just asking out of curiosity based on your
very low color contrasting black circles)
Yea, I thought that
\n was considered a regular expression, but I’m probably completely wrong. Regardless, it still should have a distinct color, especially for readability.
You are. It’s an escape sequence representing a newline. Regex only supports it, but it isn’t regex itself.
More on esc sequences here
Ah, sorry. I can’t believe I forgot those things are called escape sequences, I had done a Google search for clarity, and it did show them as Regex, the cause of my confusion. Thanks for the confirmation.
Like you said though, regardless of what it is, it should be consistently colored across all syntaxes supporting it. You might just want to change the title and OP tho to make it completely clear what your subject is.
Like Qwerty said, this might not be something Replit can fix. It might have to be put thru to Codemirror. I’m not sure if it has to be Codemirror who fixes it, but it’s just a point that I think may have to be taken into consideration
Yep, so if we get a reply saying this can’t be fixed on Replit’s end, I make an issue on their GitHub and hopefully someone can clear this up.