Live data from Hacker News

Highlighting My Code Based on How Much I Care

hank.bond

31–40 of 73 posts

Re: Highlighting My Code Based on How Much I Care

#32

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.

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.

Re: Highlighting My Code Based on How Much I Care

#33
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…

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

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.

Re: Highlighting My Code Based on How Much I Care

#34
post #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 t…

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.

Re: Highlighting My Code Based on How Much I Care

#35

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…

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

Re: Highlighting My Code Based on How Much I Care

#36
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 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 m…

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.

Re: Highlighting My Code Based on How Much I Care

#37
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…

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.

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

Re: Highlighting My Code Based on How Much I Care

#39

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.

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

Re: Highlighting My Code Based on How Much I Care

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

Post reply on HN