Live data from Hacker News

Highlighting My Code Based on How Much I Care

hank.bond

11–20 of 73 posts

Re: Highlighting My Code Based on How Much I Care

#11
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".

Re: Highlighting My Code Based on How Much I Care

#13

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.

What about comments? Do you prefer comments to stand out or stand back?

Re: Highlighting My Code Based on How Much I Care

#14
post #7

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 becau…

>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.

Re: Highlighting My Code Based on How Much I Care

#15
post #7

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 becau…

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.

Re: Highlighting My Code Based on How Much I Care

#18
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

Re: Highlighting My Code Based on How Much I Care

#19

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 synta…

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.

Re: Highlighting My Code Based on How Much I Care

#20

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.

What about comments? Do you prefer comments to stand out or stand back?

I prefer mine to have low emphasis because sometimes comments lie
Post reply on HN