Getting syntax highlighting wrong
106 comments
·October 15, 2025laristine
tagraves
I had the same experience -- it was way easier for me to find it with the rainbow highlighting (even though I already knew where to look when it came to the monochrome highlighting!).
The author later asks what color class definitions were. I think this fundamentally gets wrong how syntax highlighting helps humans. I don't have a clue what color anything is in my favored highlighting, but my brain does incredible pattern recognition to help me digest code in it without me consciously knowing what color does what.
So his arguments for why there's a problem don't hold up, but that doesn't mean there is not in fact a problem.
thewebguyd
Yeah I certainly dont' pay attention to or remember what color means what.
I am however in that weird minority that prefers light themes, and I do also prefer minimal syntax highlighting. The author does have a point to an extent, but I don't think there's any one objectively better way to do it I think it's all personal preference.
I don't like the rainbow highlighting, too distracting for me, and doesn't work particularly well with light themes. I did try the author's alabaster theme in VSCode though and it highlights the wrong things for me.
(In C#) if I have var result = await SomeMethodName(param, param, param); It put both "result" and "SomeMethodName" in blue, the rest being black. I'd actually prefer it the other way around, highlight the programming language's keywords (var and await in this case) and leave my own names (result and SomeMethodName) unhighlighted.
The theme was also inconsistent. The post says we shouldn't highlight PL keywords, but the proposed theme does highlight some keywords while ignoring others.
jchw
I agree. I was baffled when I realized I was supposed to struggle with that example.
I do agree that it is harder to see the return misspelling with the more detailed syntax highlighting, but when I'm coding I'm mainly focused on the actual tokens I'm writing, and you better believe I pick up on if the syntax highlighting is showing my token as wrongly being a keyword rather than an identifier, or the wrong type of identifier. Even if I don't actually know what the colors are, it will look wrong.
Rainbow vomit syntax highlighting logically seems like a bad idea, but like many things, even though it's hard to prove that it's better, I think a lot of people will agree that it really is better. Especially with tree-sitter and LSPs giving more detailed syntax highlighting; I can feel the benefits of 'oh, that's the wrong identifier color, isn't it?' to the point where if I run into an edge case that breaks highlighting it becomes immediately noticeable.
wijwp
I wonder if OP has some kind of color blindness that makes his examples make more sense?
I am able to parse the status quo example way better than his ideas.
My theory is helped by his use of a yellow background on black text, which is horrific to read.
Neywiny
This is like, it might've been a Veritasium video? There was some YouTube video that started with a test, and the rest was predicted on one outcome but myself and most of the audience had a different one. At worst just read the code normally, at best you can jump to specific colors
btown
To this point, I wonder if we can go even further in the direction "it's fine to have a 'zoo' of colors on the screen... as long as we're able to rapidly scan for patterns based on the shapes of code and relative positions of those colors."
Many games (especially gacha games where one may be tracking multiple orthogonal "levels" on any given piece of inventory) compress tremendous amounts of data into a character or gear item portrait; ticks on the top, dots on the side, colored frames, etc. - all so we can pick things out in a crowd without needing to set a custom sort order.
And yet our IDEs, citing silly things like "render optimizations" and "consistency with ANSI escape codes," allow each character to have just a single foreground color, a single background color, and maybe a squiggly underline. Why stop there?
Give me the freedom to add arbitrary overlays and decorations on any given token. Give me <ruby>-style elements [0] that will let me put a little colored dot or emoji at the top right of any token that meets a certain requirement... say, a utility function, or a reference from the file that's open at the top right of my screen.
Let us swim in rainbows with sparkles flying past our eyes. We're strong swimmers.
[0] https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...
surgical_fire
> It's funny that in the first example where the author asked the viewers to find the function definition, I was able to do so faster with the colorful syntax highlighting he considered wrong.
Same. It sort of killed the article for me. I also thought that in his resulting theme the limitation of colors would eventually trip me up. Having numbers and strings be the same color is terrible - I have noticed mistakes in the oast where numbers were erroneously attributed as strings for being enclosed in quotation marks precisely because my theme gives those different colors.
hansvm
The brain picks up on remarkably subtle things, especially when you can leverage its huge pattern recognition cores. I like the argument for having less clutter by default (i.e., prioritizing certain kinds of patterns over others), but it's been less than 40 minutes since an obscure syntactic highlighting based on the type of a variable saved me easily 30 seconds of debugging. It was immediately obviously wrong and immediately fixable. And I'm colorblind. I think you're able to use more colors effectively than the author gives you credit for.
nikisweeting
I must have a very different brain shape than the author. Color processing is for me subconcious, I don't get the "color overload" situation at all because my brain has hardware accelerated it long ago, there is no concious load to track additional colors or pick out differences. The only time I experience that is when looking at someone else's color scheme when pairing.
It lost me after this part:
> Here’s a quick test. Try to find the function definition here:
I found them instantly with more color, and struggled with less, and found the same for all the subsequent examples as well.
surgical_fire
> Color processing is for me subconcious, I don't get the "color overload"
Same. I noticed this on a Whatsapp group I have with old friends. About 8 people, so each gets a specific color in their name, and that's how I identify who is talking on a glance.
Once one of them switched thier phone number, and had to leave and reenter the group. This caused the colors of everyone to change.
For a couple of weeks it was hell. I was used to Person A to be pink, Person B to be yellow and so forth. I would reply to A thinking I was replying to B because their color changed, which caused a lot of confusion.
mrits
It just seems like some people prefer highlighting in the literal traditional sense while others like the more common color coordinated code.
plorkyeran
> Sometimes it gets so bad one can’t see the base text color: everything is highlighted. What’s the base text color here?
I don't understand the premise of this. What is "the base text color" and why would it be important to be able to see it? Everything is assigned some specific color and I don't understand why one of the colors would be considered more important than the others.
> Here’s a quick test. Try to find the function definition here: [...] See what I mean?
No, I don't. From the context I can figure out that the author is arguing that they're easier to find in the second example, but I found it easier with the first. They're both what I would consider pretty bad syntax highlighting schemes, though.
joe5150
I don't get this either. My code doesn't have "base text"...everything is something! I can see that not being the case for something like HTML, but not for most programming languages.
zamadatix
I actually found most of the more colorful examples easier to work with, though I'd probably prefer something more middle-ground the most. That may just be because I use Sublime most of the time and it's more middle-ground itself.
It seems like the author gets most of their value from associating the specific highlight color with a specific meaning. I think I get most of the my value from the different highlight groups. From that perspective, I don't really care if I open an editor and strings are green - I care strings form one group that's different than variable names or etc. The main problem I had with the "complicated" scheme was the reuse of purple: branching, looping, imports, functions, this, new - these are not at all related so making them purple doesn't help me (or the author), regardless of total color count.
I don't think either way is wrong, but it may feel like it to different people.
reissbaker
I've tried variations on low-color syntax highlighting (I've even tried no syntax highlighting!). While I agree most color schemes are too colorful, to the point where it's largely noise, I think trying to go super low on colors ends up hurting readability.
For example: keywords, specifically, are actually very useful to highlight. This post complains that misspelling "return" didn't make easily-scannable color changes (it changed the color from purple to red, which still looks like a special color)... But then, proposes to not highlight keywords at all, so misspelling "return" would still be impossible to quickly scan for visually! In both cases with the proposed color scheme, "return" and "retunr" would have identical coloring: white.
Generally speaking I think a lot of the visual noise of syntax highlighting comes from having too many colors. For example, you don't need the "class" keyword to have a different color than the "const" keyword — and many syntax highlighting themes are guilty of doing exactly that. But it's useful to be able to immediately, visually see if you made a typo: if you expected to write a keyword, and it's colored like normal text, you know you messed up. Similarly, it's useful when reviewing code to quickly be able to tell whether there's a typo somewhere.
I have a pretty custom syntax highlighting theme for Neovim. I have a few categories that are highlighted differently:
- Keywords
- Function calls and method calls (highlighted identically)
- Property accesses (to highlight mistakes when you're simply accessing a property instead of calling it — it's a different color than a method call)
- Non-string built-in primitive types like numbers, booleans, etc
- Strings
- Comments
- Types
Ultimately I think syntax highlighting is a tool to let you see mistakes. If you go too wild with the colors, it's true that since everything is a unique color, it's hard to tell when something is the wrong unique color. But you can use a relatively restrained palette and get a lot of value, and I think this post goes a bit too far in terms of reducing color usage.
ziml77
Your thoughts seem similar to mine. Going overboard with the colors just turns it all into visual noise. But cutting down as far as they have removes useful colors.
I've always thought the default Visual Studio color scheme was a nice balance. And I especially like the green comment color in that theme. It doesn't scream for your attention but also doesn't fade into the background (which, annoyingly, many themes do quite literally).
Of course if the author prefers their extra minimal colors I'm not going to tell them they're wrong. Though framing it as objectively better I do disagree with.
SoftTalker
I learned to code back when there was no syntax highlighting. You had one face, one font, one color on your 80x25 terminal. It might have been green, or amber, or white(ish) but that was it.
I'd prefer minimal-to-no syntax highlighting except for things that should NOT be there. Nonexisting keywords should be highlighted. Unclosed strings. Unbalanced parens or brackets.
I like making comments their own color so you can easily separate them from actual code but I'm otherwise in the minimal camp.
thewebguyd
> But then, proposes to not highlight keywords at all, so misspelling "return" would still be impossible to quickly scan for visually!
Yeah I generally want the opposite. I want keywords to be the thing being highlighted.
I also really dislike overly colorful themes, and I prefer light mode (dark mode is far too hard on my eyes, oddly enough I have to strain to focus or it's fuzzy).
But the author's alabaster theme still highlights the wrong things and is inconsistent.
public async Task<byte[]> SomeMethodName(Type param, Type param) results in Task, SomeMethodName, and BOTh the data type and parameter name being highlighted.
If highlighting isn't for keywords, why is Task and the data types highlighted?
likewise var result = await SomeMethodName(param, param); has result and SomeMethodName highlighted and I generally want the opposite, I want the PL's keywords highlighted and nothing else.
tasuki
> prefer light mode
I prefer dark mode (precisely for the garish colors, sorry), but been using light mode... because it's hard to make everything use dark mode!
When my terminal was dark, the eg some docs in the browser were light, switching back and forth was quite painful. Yes, it's super simple for websites to detect the preferred color scheme with @media (prefers-color-scheme: dark) {}, yet most (such as this one) don't. I could use some hacks, but then I'm in for a world of pain. So I just use light theme everywhere and it's ok(ish).
cvoss
> Please, please don’t highlight language keywords.
Agreed with almost everything the author had to say, but not this. Hard disagree. In my view, keywords are the single most important thing to highlight. I'd be ok without anything else. Keywords sketch the structure of the program in most languages. The thing I want my eye drawn to, in the case of top-level definitions, for example, is the keyword. It's the predictable anchor as I'm scanning a long series of definitions. The identifiers are not: some are long, some are (very) short.
And how do I understand the control flow of my program? I look at keywords. If I want to read the condition, I have to find the condition. But all the conditions look different. What's the reliable way to spot them? The predictable 'if' that precedes each one, without fail.
My eye is a parser. It needs to recognize tokens. But some tokens are easy to confuse: keywords look just like identifiers.
m463
I kind of agree, but I think it might be ok to turn off keywords sometimes, unless broken. Highlight "retunr" in reverse video.
battesonb
Agreed on this. Especially with the return keyword argument presented in the same article.
An assertion of correctness relating to a matter of taste is, ironically, going to be trivially falsifiable. Even though I found myself personally agreeing with most of what the author had to say (for my tastes)! I definitely want to try lifting the visual importance of comments.
munificent
It is hard to take color advice from someone who thinks it's a good idea for their blog to be black on intense yellow, with code samples light on black background.
I'm not being facetious. The author is trying to show comparisons to the reader of various syntax highlighting schemes, but any difference between them is overwhelmed by the massive contrast between the bright yellow background and the black background of the code samples.
smlavine
I think it's fine. Better than purple on dark-grey that I've seen posted here.
hn_acc1
Dang, that was hard on the eyes..
morshu9001
I agree with the advice but yeah, this website burned my eyes
dysoco
I think it's fine and it's certainly very recognizable
ash_091
Agreed, I had to check a couple of other pages on his site to make sure it wasn't ironically done for just that particular post.
bitexploder
I immediately stopped reading when I saw the yellow. I like colors. I like rainbow delimiters. I will not change at this point. I am okay with minimalistic highlighting. Used to use visual studio with more minimalistic highlighting, and that was fine too. It is a preference and I don't think it is worth indexing much on. If it bothers you, change it until it doesn't. I don't think about it much.
laktak
yellow? had to go back to check - Try Darkreader :)
Svoka
I know. This is literally the ugliest page I saw this year. Bright background, bunch of ugly signs in header, text just gaslighting you about some shit.
avdwrks
I agree that certain schemes overdo it with highlighting, but I disagree with his statements that things like function calls and keywords shouldn't be highlighted. Basically, if everything is important then nothing is; but I still want my code to be easily scannable. Right now I'm using using a version of Solarized that uses the default VSCode syntax highlighting and it's been pretty great.
ash_091
> Close your eyes (not yet! Finish this sentence first) and try to remember what color your color theme uses for class names? Can you? If the answer for both questions is “no”, then your color theme is not functional.
I'm sure this varies person-to-person, but for me at least this is not a good test.
I couldn't list the notes in Clair De Lun, but I'd certainly notice if I heard the wrong note played. In much the same way, I have no idea what color classes are in my theme, but I certainly notice when it's wrong.
jraph
Like many comments here, I disagree with this article.
Notably, I don't necessarily remember which colors are used by my code editors off the top of my head, but you can be damn sure that if the smallest thing is different tomorrow, I will notice, and if anything is the wrong color, I will immediately notice something is wrong. Put as many colors as possible and it makes it easier for me to spot any mistake. Although I can understand that more than a few colors can be distracting to some people.
As for "everyone does it wrong", and in particular wtt the Christmas tree effect, I find Kate's and IDEA's default color themes quite well designed and balanced, and where each sub expression start and end.
I do find light themes far more readable, and only use dark themes under very bad lighting conditions where a white background would hurt the eyes even at minimal screen brightness.
Bonus topic: in the Christmas tree screenshots, you can notice that parentheses are of different colors. This creates a visual mess but I do activate this option in Kate anyway because it is very useful to quickly check that the parentheses are balanc
It's less necessary when you have syntax checking though, because the editor will put a red background or draw squiggles.
take-five
I mostly agree with the author - Christmas tree is a mess. But I also think the final theme was too minimalistic. I find it incredibly helpful when language keywords like "try", "await", or "new" are highlighted.
IshKebab
I agree. Not even highlighting keywords is silly. The overly colourful example he gave is bad, but his alternative is bad in the opposite direction. Middle ground is where it's at.
> Here’s a quick test. Try to find the function definition here
It's funny that in the first example where the author asked the viewers to find the function definition, I was able to do so faster with the colorful syntax highlighting he considered wrong.
To recognize different elements of code is more than just colors, but actual syntaxes of the language and the general shapes of code blocks.
It's a matter of taste, and in my decades of programming, I've found colleagues and many teams trying for all kinds of fancy themes only to come back with a "boring" one, like Material Theme, which is also my main driver nowadays.
I think the author had some good ideas, particularly around literals (what he called constants), rejection of the requirement for equal brightness, and emphasizing comments. The author is more than welcome to bring his version of perfect syntax highlighting to the market of ideas. Its adoption should prove it if his idea wins.