When I’m programming, and a fellow programmer looks over my shoulder, the first thing they invariably say is some variation of “Wow, no syntax highlighting? I can hardly read that.”
Ever since I started programming almost 15 years ago, I have preferred very minimal syntax highlighting—typically just keywords, comments, and string literals. I have synaesthesia, so I find anything more involved to be distracting, due to the mismatch between my perception of the colour of a word and the colour in which it’s rendered on the screen. So now my default programming theme is simply black text on a white background, usually in Source Code Pro.
When I see someone working in a wild palette of pinks and purples and yellows and greens, I can agree that it looks pretty—but it interferes with my ability to read the code. It feels nothing but gratuitous. When you read a novel, the words aren’t highlighted for their grammatical categories; when you read mathematics, the symbols aren’t highlighted for their syntactic categories; so why do we do this in programming?
Perhaps it’s because our notations are impoverished by their rendition in monospaced fonts using the subset of ASCII that’s convenient to type on an American keyboard—but couldn’t we use proportional fonts and better input methods? Perhaps it’s because our languages include lexical elements such as comments and (sometimes) string literals that can span multiple lines and “run away” to produce odd syntactic errors—but couldn’t we make such error messages smarter? Perhaps it’s because we don’t know our own languages well enough, so we need interactive help on which keywords are available and which syntax is valid—but why do our languages have so much syntax?
Often, syntax highlighting is outright incorrect, particularly in syntactically complex languages like C++ and Perl. Just as often, it’s misleading to beginners, who tend to interpret things highlighted in a way they don’t understand as erroneous, even if they’re actually correct.
Every justification I can find for syntax highlighting can be refuted by an appeal to better tooling. It appears that we only use syntax highlighting as a workaround for the lack of these tools, and because it’s something to which we grow accustomed by virtue of its ubiquity.