Highlighting My Code Based on How Much I Care

(hank.bond)

35 points | by hankbond 2 days ago

8 comments

  • sph 38 minutes 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, 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.)

    • embedding-shape 22 minutes 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! ;)

  • nelsonfigueroa 18 minutes 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 ;)

  • KronisLV 1 hour ago
    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.
  • cauliflower99 27 minutes ago
    Really enjoyable read - well done! I wonder where else we could use an effective, minimal approach that solves the problem at first principles?
  • burticlies 1 hour 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.

  • WhyIsItAlwaysHN 1 hour 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

  • applfanboysbgon 40 minutes 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.
  • tefkah 1 hour ago
    i’m surprise by how much i liked that! also: neutrality website, very tasteful