Rendered at 19:47:21 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
nrabulinski 8 hours ago [-]
> try to remember what color your color theme uses for class names?
While I overall agree with the point of this post and the post being cited, I disagree with the premise that you need to be able to actively recall facts like this. The theme I personally use is quite toned down, but it does use different colors for variables, keywords, arguments, type names, and a few other classes of tokens. I don’t consciously think “hmm, what color is an argument” to look for those in my code - I just see them, have learned them over the years, and it’s muscle memory at this point, and helps me read the code. Just like I can’t remember the code to my apartment building, yet I type it in multiple times every day.
NoboruWataya 8 hours ago [-]
> Just like I can’t remember the code to my apartment building, yet I type it in multiple times every day.
To me it's even less problematic than this. Not being able to remember important codes except via muscle memory is quite unsettling for me because every now and again my muscle memory fails. Like I will get to an ATM and think "wait - what is my PIN?".
With syntax highlighting, even if my muscle memory fails me I still benefit from syntax highlighting (I think). Because I can immediately see the structure of each line. If I am looking through code for a particular thing, I will probably be able to disregard entire lines because they obviously don't have the structure I am looking for. And even within a line, I can just look at the beginning of each "span", immediately know if it's what I'm looking for, and skip to the next span if it's not.
setopt 6 hours ago [-]
> Like I will get to an ATM and think "wait - what is my PIN?".
Apple also has this stupid thing where you sometimes have to type your iPhone pin on your Mac to verify your identity. I’m unable to recall it on a keyboard instead of a keypad.
setopt 6 hours ago [-]
> have learned them over the years
Well I guess that’s the difference? I personally change themes many times per day depending on my mood and the lighting conditions, and probably go through at least a few dozen themes in a year.
I don’t need to memorize colors either though, I look for differences in colors not absolute colors.
TacticalCoder 6 hours ago [-]
> I disagree with the premise that you need to be able to actively recall facts like this
Same. The goal is to differentiate things. I code mostly in Clojure and I love functional code, so the one thing that really stands out is anything that does mutable things: for example there's swap! in Clojure and that one is "bold fluo blue on a near dark background". I don't use it often, so it sticks out like a sore thumb. But I don't need to remember which hexcode I used for the fluorescent blue: I just know it's obvious.
Same for "rainbow parentheses": it helps visually see where the matching closing parenthesis is without needing to put the cursor on the opening parenthesis (which I can do too if I want).
My color code is mostly toned down too.
sph 12 hours ago [-]
I am convinced everybody gets syntax highlighting wrong and this article backs me up.
My pet peeves:
- I have no idea how people are supposed to be productive with non-semantic rainbow vomit themes that are so popular in modern editors. I'm too ADHD to want to be overly stimulated by useless information.
- I routinely hate encountering Zig code on Github, where the theme they use turns everything brown. Oh it's because it's a struct member. Dude, everything is a struct member in Zig, it's silly to allocate a vibrant colour for what amounts to 90% of the source code. Random example off my browser history: https://github.com/foxnne/aftersun/blob/main/src/time/enviro...
- Yesterday I opened some Lisp code in KDE's KWrite text editor, and every single default theme highlights parens with a bold font + vibrant colour to make them stand out. Parens in Lisp are supposed to fade in the background, not pop in your face. It was completely unusable, I had to turn off syntax highlighting.
Always seeking good, minimal, muted colour themes for my editors. I wish we had serious designers to design themes for usability and comfort, and not people that have no business playing with colours.
I remember a colleague that used to write code with syntax highlighting off, and thought that was an eccentric choice. The older I get, the more I appreciate his wisdom. I'd rather have no syntax highlighting than bad one; at least one would try to make the code easy to parse by its structure alone (shorter lines, comments to delimit sections, etc.)
kqr 9 hours ago [-]
Completely with you. I've played with limited syntax highlighting in the past (class names were blue, to answer the question in TFA), but for the past few years I've been running with plain black-on-white, with only a green highlight for comments, and a subtle yellow for strings.
I think the relatively bold highlighting of comments is important – lots of times I'm the only person to react to incorrect comments because people's themes blur them into the background and they stop reading them.
I get the origins of low contrast comments - auto-generated stuff in old Java code was basically a box ticking exercise to please checkers that only checked if comments were available, probably for javadoc purposes, making these comments useless noise.
But that's only Java, and I want to believe most people moved away from box ticking exercises like javadoc blocks. Comments should be important and thus high contrast.
DiggyJohnson 5 hours ago [-]
Thanks for sharing I love this theme. Implementing it now this morning and really appreciate the middle ground between no highlighting and the popular rainbow chaos themes.
sph 7 hours ago [-]
Agreed 100% on highlighting the comments, that's what I also prefer and many themes still get wrong.
saghm 7 hours ago [-]
> | have no idea how people are supposed to be productive with non-semantic rainbow vomit themes that are so popular in modern editors. I'm too ADHD to want to be overly stimulated by useless information.
At least personally, I've been living with ADHD long enough to have had to learn to cope with the fact that even if I tried to suppress various stimuli in my environment, I'd still find something distracting. Pretty much all of life is filled with background noise for me, so having some of the syntax look noticeably different is not that much of a net increase to distraction for me. To you my color scheme probably looks like "rainbow vomit", but I like bright colors on a black background, and I'm the one who spends all day looking at it, so why should it matter whether you like it as well?
flexagoon 10 hours ago [-]
> I have no idea how people are supposed to be productive with non-semantic rainbow vomit themes that are so popular in modern editors.
That depends on what your use for syntax highlighting is. If you use it to find specific types of code, than yeah, it's probably unhelpful. But for me, the point of syntax highlighting is to just make reading easier by separating different parts of the code with different colors. I have absolutely no idea what each color means in my editor, it just matters that they're different.
skydhash 9 hours ago [-]
I’ve been using vi (nvi) and mg and both doesn’t have syntax highlighting. I’ve copied a monochrome theme of github for my vim setup and my emacs config is using modus operandis which is somewhat minimal and muted.
While I can use rainbow color, but this day syntax highlighting kinda fades into the background as I don’t care that much. I like it for something like React and html for the tags part but indentation is much better than highlighting in my opinion.
tgv 6 hours ago [-]
I'm color blind. Most color schemes just fuck up reading. Or they hurt my eyes. I haven't found anything that really convinces me, although having some words in bold does help, but the number should be quite limited. I can see the structure easily enough, so there's no need to emphasize "THERE'S AN IF HERE, IT IS A RESERVED KEYWORD!!".
my-next-account 11 hours ago [-]
>Always seeking good, minimal, muted colour themes for my editors. I wish we had serious designers to design themes for usability and comfort, and not people that have no business playing with colours.
I think Prot's Emacs themes are good for this.
sph 10 hours ago [-]
Yeah, I forgot to mention them, they're pretty good (though I use the muted colour preset, the default one is too vibrant)
andai 8 hours ago [-]
> I wish we had serious designers to design themes for usability and comfort, and not people that have no business playing with colours.
It's programmer art!
embedding-shape 11 hours ago [-]
> Always seeking good, minimal, muted colour themes for my editors. I wish we had serious designers to design themes for usability and comfort, and not people that have no business playing with colours.
I want the same as you, but probably also the same as you; I'm too lazy to do it myself. Maybe do all of us an favor, and create that yourself and share it with us? I too prefer no syntax highlight than bad one, and most out there are bad, and you clearly grok a bit more than the typical color scheme creator/maintainer, so you're already 50% there! ;)
sph 10 hours ago [-]
I have a crappy Emacs theme I built myself, inspired by Jon Blow's Emacs theme he uses on his stream which I find very peaceful to look at, but with a more bluish/indigo hue. It's full of bugs, so not comfortable sharing honestly, but I think it's worth spending an afternoon creating your own
9 hours ago [-]
hanuffs 9 hours ago [-]
I like pastel colors as well. So I use a GNOME extension that controllably mutes all colors on the screen. Makes my screen almost look like a color e-ink display. Muting it to an extreme makes it grayscale.
chrismorgan 11 hours ago [-]
Maybe a decade ago, I decided to start a theme from scratch, named bland. Initially, it was just black on white, with keywords bold, comments, macro invocations and lifetime tokens (this was all focusing on Rust) italic, and escape sequences bold italic. I decided to wait a week before deciding if I would add any colours at all. As expected, after that week I made strings red, comments green and numbers blue. Since then, I’ve made number type suffixes light blue, macro-related things orange, and delimiters grey (I should try dropping that one again). But things like making type, async, function*, for, const, of, &c. different? No, they’re all just bold black, no need to try distinguishing between them.
I also subsequently made a dark variant of it for my website’s dark mode and for occasions I want to use an editor in a dark place.
The colours involved are all high-contrast, using the RGB channels provided rather than trying to be silly with low contrast: #fff, #000, #c00, #090, #00c to begin with.
But I have no particular interest in publishing this in a form others can consume in whatever editors they use. Plenty of small tweaks that I develop over time, half for my own Vim syntax files. I think the approach itself, of experimenting deliberately yourself, is worthwhile.
wzdd 10 hours ago [-]
These rethinking-highlighting posts always start out with the wrong premise. The color for class names in my code is the color all the class names have. After a short time working with the code I would notice if one looked off.
The brain is really very efficient. You don’t optimise for random out of context recall unless you really try hard to do so. It says nothing about the efficacy of the scheme.
mattlondon 8 hours ago [-]
Hmm this wasn't quite what I expected.
I thought that this might be some sort of highlight based on complexity/risk/importance. That immediately struck me as a "why didn't I think of that?!" moment when actually turns out they didn't either.
So I can imagine a scenario where you have a LLM agent's diff to review while iterating in an IDE. The diff would highlighted according to importance/complexity for human review. Trivia like getters and setters would be grey. Highly complex or complicated or risky code would be highlighted in some high-contrast bold colour (perhaps with a luminance scale depending on how critical it was). Then when you are reviewing the diff from the agent you can instantly see and focus on the most important bits that need the most attention.
I'd find that really useful.
FridgeSeal 9 hours ago [-]
I couldn’t tell you what colour my functions or structure syntax is, but I can tell you when I look at code, that the presence of the colour instantly lets me straight to whatever part of the text I care about at that moment.
noxss 11 hours ago [-]
In my case, colors matter because they help me read faster the keywords of a language that define algorithms such as conditionals, loops, beginnings and ends of functions, returns... without color it is more difficult to send the eye to the correct position. Perhaps it's due to habit or visual memory?
Good article that gives you food for thought
twitchard 4 hours ago [-]
If rule-based highlighting of syntax is meaningfully helpful for reading code then how come nobody uses rule-based syntax highlighting of prose?
Why don't we visually emphasize the verb in a sentence and deemphasize articles and prepositions, for example?
In prose the author can *bold* or italicize text to emphasize ad-hoc, or make ## headings for scanning. Why can't we do such ad-hoc emphases in code?
theokrueger 3 hours ago [-]
one time i made a nlp-based syntax highlighter for english ebooks, and it was pretty interesting.
in using it, i believe that it's a little handholdy and reduces expression when every word has some color based on it's part of speech. intentional application of this would be incredibly fun to read, if not incredibly tedious to write
WorldMaker 1 hours ago [-]
I saw a dyslexic/speed reading app that did something like this once. I don't know how useful that was in practice, but the theory of it was pretty compelling. Most sight reading is based on the overall shape of the word (rather than the component letters, we rarely actually read letter at a time [0]), and for different reasons word shape alone is still to slow for dyslexic and speed readers, so adding an extra channel of color can help speed up reading for both audiences of reader.
[0] Which is why UPPERCASE TEXT is a reading speed bump for almost all readers because word shapes blur together into "just rectangles" more. Which is also why the "slow reveal" pattern in most visual novel genres is often very wrong for English text. (Most simply reveal character at a time which makes sense for CJK ideograms because one character is at least a full syllable if not also a full word. When the pattern was copied to English translations it probably should have been done word at a time rather than character at a time.)
pasc1878 11 hours ago [-]
I found this site very difficult to read and I had to give up as it was hurting – the font is unreadable.
As for syntax highlighting – I don't like it either.
I use themes that change colour according to their nesting level.
econ 9 hours ago [-]
I thought about nesting level coloring but had never seen it in action. I just look at it and it indeed looks nice.
I thought it would be interesting as it separates that what repeats a task from the actual work being done on it.
More nesting suggests more complexity.
In my experiments I notice different ways to write something look better with different kinds of highlighting.
If you for example use no highlights dividing the logic over tiny functions looks quite readable.
In one experiment I use dark colors on a black background with only the comments in bright white. I wrote a lot more comments using that. Everything had a description and I could gaze over it as if the code wasn't there.
nchmy 9 hours ago [-]
Yeah, it's just offensive to look at. Makes it significantly less likely that the author has useful things to say about font, highlighting etc. Not gonna bother finding out
burticlies 12 hours ago [-]
I like highlighting only the language concepts:
Reserved words are red
Strings are green
Constants/numbers are blue
Types/meta-language are yellow
Anything else is white.
It’s not too colorful but still gives you plenty of anchors for your eyes.
commandersaki 5 hours ago [-]
I use the default neovim theme and I feel that's essentially what I get out of it. Feels like sometimes I don't have highlighting enabled.
weinzierl 11 hours ago [-]
What about comments? Do you prefer comments to stand out or stand back?
polyterative 10 hours ago [-]
I prefer mine to have low emphasis because sometimes comments lie
wittachai 7 hours ago [-]
[dead]
rfgplk 7 hours ago [-]
I like the styling of the blog, but the font is actually very hard on the eyes.
jasonjmcghee 6 hours ago [-]
(If it's not just for reading / presentation and you're actually working with the code)
using underlining / background color as part of syntax highlighting will conflict with LSP/IDE diagnostics unless their presentation is redone as well. many editors don't provide that control
orphereus 8 hours ago [-]
I get the theme of the site is inspired by retro games, but the font makes it so hard to read the article, I had to give up. Too bad, since I like the concept of a retro game theme.
andai 8 hours ago [-]
I enjoyed it. The italic pixels feel like some kind of crime though.
aos 7 hours ago [-]
I decided a few years back to forego color all-together in my syntax highlighting because it was always more distracting than helpful.
I built this monochrome and low-contrast simple colorscheme for vim and I’ve been using it since. Haven’t missed colors at all.
Cool article, really cool website (the font could also be a bit smaller, if it didn't mess with the fidelity), but the grayscale setup just doesn’t have enough contrast for my eyes to reliably pick up on it at a glance.
nelsonfigueroa 11 hours ago [-]
I went through a similar journey not too long ago. I also asked myself "Why does highlighting even need to be in color?" when reworking my blog. I wanted a monochromatic look for my entire site, including code blocks. I noticed code blocks are still very readable as long as there's different tones. I still like pretty colors so I compromised by doing normal syntax highlighting when a code block is hovered over (or tapped on mobile).
Btw the dynamic highlighting by clicking on the code is so cool. I may or may not steal that idea ;)
Valodim 11 hours ago [-]
Good article, enjoyed it. I might give this idea a shot!
> Comments: these contain high level descriptions (faster than reading the code) and external context (the “why” that reading code can’t answer). This is the most scannable thing in any big code file.
Not sure about that one, depending on comment culture. Comments are prose and not structured, so to understand their meaning is a lot more cognitive load for me than (most) code. I certainly wouldn't have thought to call them "scannable".
Lindby 10 hours ago [-]
I totally agree with you about the comments. Code is so much easier to grok. The comments are there as a reference that you can concentrate on if the code doesn't make sense to you.
econ 9 hours ago [-]
I switch if the code is very ugly and unreadable. Often overly optimized things. One jumps to mind when I rewrote something to generate regexes.
adamtaylor_13 8 hours ago [-]
If they're not scannable, there's a good chance they're too dense and should be rewritten.
dainank 11 hours ago [-]
Maybe I missed it but has he posted his theme anywhere (I assume for VSCode since he mentioned he is using that)?
WhyIsItAlwaysHN 13 hours ago [-]
The continue keyword is also important, or alternatively the condition to run it.
I often fail to notice it on the first look of some snippet of code
3371 5 hours ago [-]
This makes we wonder if anyone have tried to track attention to code with eye tracker
meerita 6 hours ago [-]
I became fan of Tsoding Emacs theme. I like how subtle his colors are used to highlight parts of the code.
shay_ker 5 hours ago [-]
i'm actually curious if anyone has explored syntax highlighting with ML. doesn't have to be an LLM, but something that actually highlights what's interesting, or even strange, about a code snippet.
alembic_fumes 5 hours ago [-]
I did somewhen toy with the idea of comparing how a line of code is written to what an LLM-based next-token-prediction would emit for the same line. Then it might be possible to highlight the pieces of code that most differ from what an LLM would have written.
The base form isn't too useful by itself, but I expect if one would "seed" the LLM with a prompt about focusing specifically on a particular class of errors, it might be possible to find violations by seeing where the code completely deviates from what an LLM would have written.
Never got around to doing anything with this, but I expect a prototype should take no more than a day with some agent-assisted coding ;) Tell me how it went if you try!
cainxinth 7 hours ago [-]
Somewhat related, I’ve long wanted an ereader app that color coded the characters in a novel.
0xjei 10 hours ago [-]
lovely takes! even if the percentage of techies who reads & codes effectively outside coding agents is way way smaller; I think it would be cool to apply this for reading diffs! there might be some adjustments but, I might end up trying to apply principles on top of diffs (https://diffs.com/)!
cauliflower99 11 hours ago [-]
Really enjoyable read - well done! I wonder where else we could use an effective, minimal approach that solves the problem at first principles?
vova_hn2 10 hours ago [-]
Sorry, but I think that this is a completely made up problem. I've checked out the referenced Tonsky's article [0] and for me "colorful" examples are much easier to read than his suggested alternative.
Also, I had to use reader view for TFA because of this silly pixelated font. Ironic, considering that the article is about readability.
Of course it's a made up problem, most ultimately are. Programming (and life) are full of bike sheds for those with eyes to see them, does that mean they should not be painted?
monokai_nl 8 hours ago [-]
> Here’s another test. Close your eyes (not yet! Finish this sentence first) and try to remember what color your color theme uses for class names? Can you?
Yeah. Pink for keywords, orange for arguments, yellow for strings, green for functions, blue for classes and purple for constants.
But it’s not even important if you can. Having different colors helps you quickly / unconsciously filter through different parts of your code. I agree it can be too distracting to have lots of colors (especially with semantic highlighting, which I’m no particular fan of for that reason), but a carefully calibrated theme helps most people I think.
I can also certainly imagine that some brains just work differently. Maybe for some people colors just add more noise?
a2ff6eeb0 6 hours ago [-]
How many people here are still reading code?
silentmafia 9 hours ago [-]
i like the idea, is there a theme we can download?
tefkah 13 hours ago [-]
i’m surprise by how much i liked that! also: neutrality website, very tasteful
epolanski 11 hours ago [-]
> Why does highlighting even need to be in color?
I wrote a vscode extension for effect-ts authoring that indeed leverages this concept.
It adds underlines and/or bolder fonts to emphasize different functionality.
applfanboysbgon 12 hours ago [-]
I will always yap to anyone who will listen that I think syntax highlighting was a mistake that has cost humanity untold millions of productivity hours. I only highlight comments to distinguish code from not-code, I think everything else is a pretty distraction. Note how nobody ever got the idea to apply syntax highlighting to English or any other natural language, whether in books or on forums. I could believe syntax highlighting helps learn to distinguish things when you're new to programming, but for experienced readers syntax parsing happens as automatically as it does in natural language without any need of colors.
lexicality 9 hours ago [-]
> Note how nobody ever got the idea to apply syntax highlighting to English or any other natural language
Yes they have? It's a fairly common method of teaching children sentence structure.
Pedagogy aside, take a look at what books looked like before the printing press.
> for experienced readers syntax parsing happens as automatically as it does in natural language without any need of colors.
If you're reading slowly, yes. The colours help you skim-read.
Why do you feel the need to intentionally hobble yourself? The human eyes can take in a spectacular amount of visual information at a glance, using colour, texture, shape and so on to instantly classify and identify things.
Decades of visual design research have proven that colours and shapes improve understanding and you're using a device capable of complex and rich information display, but you want it to look like a book because ..?
atiedebee 11 hours ago [-]
The article touches upon this:
> Unlike prose, where you usually read it linearly, with code you bounce around based on what connected elements you are exploring.
The moment you are jumping around a lot while reading, being able to understand the structure quickly becomes a major help. For example, dictionaries will have the words in a bold font while italicizing things like the plural etc.
applfanboysbgon 10 hours ago [-]
The punctuation/indentation already give you structure, all the highlighting does is break up the flow of actually reading. It essentially forces a micro-reset every second or third word rather than allowing you to seamlessly scan to find what you're looking for. It looks unreadable on the blog post because they have an unreadable font that is way too spacey (nothing against pixel fonts, just their particular choice of one...), but it really is way easier to read code if you try no highlighting with a real font.
I will caveat this on the fact that I use Allman brackets, and have even stronger opinions about that. K&R brackets are cancer and completely destroy the structure of code, so maybe that's why some people feel highlighting is necessary for "structure". With allman brackets, the punctuation guides your eyes to the indentation forming a clean box around each level of code, while if you draw a line from the opening bracket to the closing bracket with K&R style, half the code will be inside it and half outside it, bisecting the natural structure.
jaapz 7 hours ago [-]
It's pretty interesting that you are trying to find a reason for highlighting not working, while it's pretty obvious that many people are using highlighting and it is in fact helping them.
Just that it doesn't work for you, doesn't mean everyone is like you.
While I overall agree with the point of this post and the post being cited, I disagree with the premise that you need to be able to actively recall facts like this. The theme I personally use is quite toned down, but it does use different colors for variables, keywords, arguments, type names, and a few other classes of tokens. I don’t consciously think “hmm, what color is an argument” to look for those in my code - I just see them, have learned them over the years, and it’s muscle memory at this point, and helps me read the code. Just like I can’t remember the code to my apartment building, yet I type it in multiple times every day.
To me it's even less problematic than this. Not being able to remember important codes except via muscle memory is quite unsettling for me because every now and again my muscle memory fails. Like I will get to an ATM and think "wait - what is my PIN?".
With syntax highlighting, even if my muscle memory fails me I still benefit from syntax highlighting (I think). Because I can immediately see the structure of each line. If I am looking through code for a particular thing, I will probably be able to disregard entire lines because they obviously don't have the structure I am looking for. And even within a line, I can just look at the beginning of each "span", immediately know if it's what I'm looking for, and skip to the next span if it's not.
Apple also has this stupid thing where you sometimes have to type your iPhone pin on your Mac to verify your identity. I’m unable to recall it on a keyboard instead of a keypad.
Well I guess that’s the difference? I personally change themes many times per day depending on my mood and the lighting conditions, and probably go through at least a few dozen themes in a year.
I don’t need to memorize colors either though, I look for differences in colors not absolute colors.
Same. The goal is to differentiate things. I code mostly in Clojure and I love functional code, so the one thing that really stands out is anything that does mutable things: for example there's swap! in Clojure and that one is "bold fluo blue on a near dark background". I don't use it often, so it sticks out like a sore thumb. But I don't need to remember which hexcode I used for the fluorescent blue: I just know it's obvious.
Same for "rainbow parentheses": it helps visually see where the matching closing parenthesis is without needing to put the cursor on the opening parenthesis (which I can do too if I want).
My color code is mostly toned down too.
My pet peeves:
- I have no idea how people are supposed to be productive with non-semantic rainbow vomit themes that are so popular in modern editors. I'm too ADHD to want to be overly stimulated by useless information.
- I routinely hate encountering Zig code on Github, where the theme they use turns everything brown. Oh it's because it's a struct member. Dude, everything is a struct member in Zig, it's silly to allocate a vibrant colour for what amounts to 90% of the source code. Random example off my browser history: https://github.com/foxnne/aftersun/blob/main/src/time/enviro...
- Yesterday I opened some Lisp code in KDE's KWrite text editor, and every single default theme highlights parens with a bold font + vibrant colour to make them stand out. Parens in Lisp are supposed to fade in the background, not pop in your face. It was completely unusable, I had to turn off syntax highlighting.
Always seeking good, minimal, muted colour themes for my editors. I wish we had serious designers to design themes for usability and comfort, and not people that have no business playing with colours.
I remember a colleague that used to write code with syntax highlighting off, and thought that was an eccentric choice. The older I get, the more I appreciate his wisdom. I'd rather have no syntax highlighting than bad one; at least one would try to make the code easy to parse by its structure alone (shorter lines, comments to delimit sections, etc.)
https://i.xkqr.org/lighttheme.png
I think the relatively bold highlighting of comments is important – lots of times I'm the only person to react to incorrect comments because people's themes blur them into the background and they stop reading them.
(But then again, I'm crazy. I colour diffs blue and orange: https://i.xkqr.org/blueyellowdiffs.png inspired by similar advice in https://jameshfisher.com/2014/05/11/your-syntax-highlighter-... I think it has worked to help me notice things other reviewers have not, but it's hard to know for sure.)
But that's only Java, and I want to believe most people moved away from box ticking exercises like javadoc blocks. Comments should be important and thus high contrast.
At least personally, I've been living with ADHD long enough to have had to learn to cope with the fact that even if I tried to suppress various stimuli in my environment, I'd still find something distracting. Pretty much all of life is filled with background noise for me, so having some of the syntax look noticeably different is not that much of a net increase to distraction for me. To you my color scheme probably looks like "rainbow vomit", but I like bright colors on a black background, and I'm the one who spends all day looking at it, so why should it matter whether you like it as well?
That depends on what your use for syntax highlighting is. If you use it to find specific types of code, than yeah, it's probably unhelpful. But for me, the point of syntax highlighting is to just make reading easier by separating different parts of the code with different colors. I have absolutely no idea what each color means in my editor, it just matters that they're different.
While I can use rainbow color, but this day syntax highlighting kinda fades into the background as I don’t care that much. I like it for something like React and html for the tags part but indentation is much better than highlighting in my opinion.
I think Prot's Emacs themes are good for this.
It's programmer art!
I want the same as you, but probably also the same as you; I'm too lazy to do it myself. Maybe do all of us an favor, and create that yourself and share it with us? I too prefer no syntax highlight than bad one, and most out there are bad, and you clearly grok a bit more than the typical color scheme creator/maintainer, so you're already 50% there! ;)
I also subsequently made a dark variant of it for my website’s dark mode and for occasions I want to use an editor in a dark place.
The colours involved are all high-contrast, using the RGB channels provided rather than trying to be silly with low contrast: #fff, #000, #c00, #090, #00c to begin with.
But I have no particular interest in publishing this in a form others can consume in whatever editors they use. Plenty of small tweaks that I develop over time, half for my own Vim syntax files. I think the approach itself, of experimenting deliberately yourself, is worthwhile.
I thought that this might be some sort of highlight based on complexity/risk/importance. That immediately struck me as a "why didn't I think of that?!" moment when actually turns out they didn't either.
So I can imagine a scenario where you have a LLM agent's diff to review while iterating in an IDE. The diff would highlighted according to importance/complexity for human review. Trivia like getters and setters would be grey. Highly complex or complicated or risky code would be highlighted in some high-contrast bold colour (perhaps with a luminance scale depending on how critical it was). Then when you are reviewing the diff from the agent you can instantly see and focus on the most important bits that need the most attention.
I'd find that really useful.
Good article that gives you food for thought
Why don't we visually emphasize the verb in a sentence and deemphasize articles and prepositions, for example?
In prose the author can *bold* or italicize text to emphasize ad-hoc, or make ## headings for scanning. Why can't we do such ad-hoc emphases in code?
in using it, i believe that it's a little handholdy and reduces expression when every word has some color based on it's part of speech. intentional application of this would be incredibly fun to read, if not incredibly tedious to write
[0] Which is why UPPERCASE TEXT is a reading speed bump for almost all readers because word shapes blur together into "just rectangles" more. Which is also why the "slow reveal" pattern in most visual novel genres is often very wrong for English text. (Most simply reveal character at a time which makes sense for CJK ideograms because one character is at least a full syllable if not also a full word. When the pattern was copied to English translations it probably should have been done word at a time rather than character at a time.)
As for syntax highlighting – I don't like it either.
I use themes that change colour according to their nesting level.
I thought it would be interesting as it separates that what repeats a task from the actual work being done on it.
More nesting suggests more complexity.
In my experiments I notice different ways to write something look better with different kinds of highlighting.
If you for example use no highlights dividing the logic over tiny functions looks quite readable.
In one experiment I use dark colors on a black background with only the comments in bright white. I wrote a lot more comments using that. Everything had a description and I could gaze over it as if the code wasn't there.
Reserved words are red
Strings are green
Constants/numbers are blue
Types/meta-language are yellow
Anything else is white.
It’s not too colorful but still gives you plenty of anchors for your eyes.
using underlining / background color as part of syntax highlighting will conflict with LSP/IDE diagnostics unless their presentation is redone as well. many editors don't provide that control
I built this monochrome and low-contrast simple colorscheme for vim and I’ve been using it since. Haven’t missed colors at all.
https://github.com/aos/vim-ascetic
Btw the dynamic highlighting by clicking on the code is so cool. I may or may not steal that idea ;)
> Comments: these contain high level descriptions (faster than reading the code) and external context (the “why” that reading code can’t answer). This is the most scannable thing in any big code file.
Not sure about that one, depending on comment culture. Comments are prose and not structured, so to understand their meaning is a lot more cognitive load for me than (most) code. I certainly wouldn't have thought to call them "scannable".
I often fail to notice it on the first look of some snippet of code
The base form isn't too useful by itself, but I expect if one would "seed" the LLM with a prompt about focusing specifically on a particular class of errors, it might be possible to find violations by seeing where the code completely deviates from what an LLM would have written.
Never got around to doing anything with this, but I expect a prototype should take no more than a day with some agent-assisted coding ;) Tell me how it went if you try!
Also, I had to use reader view for TFA because of this silly pixelated font. Ironic, considering that the article is about readability.
[0] https://tonsky.me/blog/syntax-highlighting/
Yeah. Pink for keywords, orange for arguments, yellow for strings, green for functions, blue for classes and purple for constants.
But it’s not even important if you can. Having different colors helps you quickly / unconsciously filter through different parts of your code. I agree it can be too distracting to have lots of colors (especially with semantic highlighting, which I’m no particular fan of for that reason), but a carefully calibrated theme helps most people I think.
I can also certainly imagine that some brains just work differently. Maybe for some people colors just add more noise?
I wrote a vscode extension for effect-ts authoring that indeed leverages this concept.
It adds underlines and/or bolder fonts to emphasize different functionality.
Yes they have? It's a fairly common method of teaching children sentence structure.
Pedagogy aside, take a look at what books looked like before the printing press.
> for experienced readers syntax parsing happens as automatically as it does in natural language without any need of colors.
If you're reading slowly, yes. The colours help you skim-read.
Why do you feel the need to intentionally hobble yourself? The human eyes can take in a spectacular amount of visual information at a glance, using colour, texture, shape and so on to instantly classify and identify things.
Decades of visual design research have proven that colours and shapes improve understanding and you're using a device capable of complex and rich information display, but you want it to look like a book because ..?
> Unlike prose, where you usually read it linearly, with code you bounce around based on what connected elements you are exploring.
The moment you are jumping around a lot while reading, being able to understand the structure quickly becomes a major help. For example, dictionaries will have the words in a bold font while italicizing things like the plural etc.
I will caveat this on the fact that I use Allman brackets, and have even stronger opinions about that. K&R brackets are cancer and completely destroy the structure of code, so maybe that's why some people feel highlighting is necessary for "structure". With allman brackets, the punctuation guides your eyes to the indentation forming a clean box around each level of code, while if you draw a line from the opening bracket to the closing bracket with K&R style, half the code will be inside it and half outside it, bisecting the natural structure.
Just that it doesn't work for you, doesn't mean everyone is like you.