I am sorry, but everyone is getting syntax highlighting wrong

Applying human ergonomics and design principles to syntax highlighting

tonsky.me
Hell yeah, we have beaten Apple _and_ AI!
Peeked into comments. Without live cursors or google-style presence avatars, people went back to discuss background color. Well
@nikitonsky at this point, I feel like the day you'll change, if it ever comes, it will be a loss for everyone.
@nikitonsky Nice work! I'm complained many times about how so many colour schemes use the lowest constrast they can get away with for comments.
@nikitonsky this is literally my last rant on twitter
@eugensson yep. People are so used to it they never questioned the premise
@nikitonsky Alabaster is a gift, thank you for caring about this stuff
@nikitonsky not sure I agree with regards to bold and italics (though I kinda understand your reasoning), but great read nonetheless 👍🏻
@nikitonsky Great article! Will try out that theme in Rider. Seems like there's a version for Visual Studio too https://marketplace.visualstudio.com/items?itemName=NicolaiVerbaarschot.alabaster-variant-theme
Alabaster Variant Theme - Visual Studio Marketplace

Extension for Visual Studio Code - A theme set inspired by Tonsky's Alabaster

@nikitonsky

Next, let’s tone down punctuation

And now you've lost me. "Toning down" means lowering contrast means making it harder to read. Why would I want any part of the code to be hard to read?

@barubary for me, it puts text and punctuation almost on different planes. Helps me read names easier, stuff like parentheses and commas don’t stick to them. Easier to see where words start and end
@nikitonsky Easier to confuse ( and {, or , and ., or ; and :, or >= and =>. If you find it hard to visually separate letters/words and punctuation, may I suggest giving them different colors? 😈
@barubary there’s not a lot of cases in practice where someone puts `,` in place of `.`
@nikitonsky Unwarranted generalization, I think. Just the other day I found a line were someone had typed , instead of ; in Real Code™. And I have definitely seen () vs {} mixups.
@nikitonsky I really enjoyed using the Alabaster theme! This concept is something that you don’t realize until someone puts the finger on it. ☝️
I had some bugs with the JetBrains version, but haven’t gotten around to debug it, so I run some regular ”christmas lights” theme at the moment. 😅
Syntax highlighting is a waste of an information channel

No newsletter next week Running the TLA+ workshop. No way I'm gonna have any brainpower after that. Syntax highlighting is a waste of an information channel...

Computer Things
@nikitonsky The black on very bright yellow is pretty hard to read...
@nikitonsky Wait, there's something odd going on! The yellow is much more subdued when I open your blog on Chrome, instead of Firefox. I don't think I've seen that before
@Kiloku
If you're looking at both browsers on the same display, I think Firefox adjusts itself based on the color profile of the display.
@nikitonsky

@nikitonsky I've also been using my own restrained theme for ages now: https://codeberg.org/aerique/emacs-theme-aerique#emacs-theme-aerique

Another important aspect of what restrained themes do is partitioning the code into easily scannable pieces.

emacs-theme-aerique

Theme centered on minimal syntax highlighting and distinct but not too harsh or distracting colors.

Codeberg.org
@nikitonsky Also reminds me that I sometimes wish assignment and comparison operators would at least not be highlighted in the same way, could make the change to my editor but usually too lazy for that as I tend to use a bunch of different languages.
@nikitonsky
Back in the ancient days of monochrome displays, programming in Ada (or Pascal), I kinda liked keywords in bold, which IIRC was how they were shown in the Ada Language Reference Manual. But even though I was used to that, I don't really think it was very helpful.

@nikitonsky To me it's always been key to *stick to it*. That is: I started in Turbo C++ 3.0 on DOS, and I have never switched color scheme and only switched font once (and to something very similar).

Investing in training your brain on a theme for decades is key to making it work imo.

@nikitonsky I’ve had many of the same thoughts, and created this Textmate theme: https://github.com/KaptajnKold/Minimal
GitHub - KaptajnKold/Minimal: A minimalistic syntax colouring theme for TextMate

A minimalistic syntax colouring theme for TextMate - KaptajnKold/Minimal

GitHub

@nikitonsky

Per statistics, 70% of developers prefer dark themes. Being in the other 30%, that question always puzzled me. Why?I'm not convinced this is related to colour contrast; for me the reason is a much more basic "my eyes can't handle staring into a searchlight eight hours a day"...

@nikitonsky This was really interesting to read, thanks! It makes a lot of sense.

My brain works against me, so don't think I could make the switch, though. Way too used to my christmas lighting by now. Even considering a font change is too much 😆🤷‍♂️

@nikitonsky I disagree with the premise: Highlighting is not for making things stand out. It's for distinguishing different lexemes. I don't need function names or "retunr" misspellings to stand out. That's what other highlighting layers are for, such as fold markers and linter error squiggly lines. I need to see whether something is a type name, a variable name, a function name, or a keyword, especially in syntactically complex languages such as Rust or C++.
@nikitonsky "Comments should be highlighted, not hidden away". THIS.

@nikitonsky hey, good post, agree on most of the things.

So one case of using bold and italic instead of background colors would be to use background color for search highlighting, e.g.

@nikitonsky Did the animals have to go? And cursors too :(
@alberand yeah, I’m thinking what to replace them with. They were too distracting
@nikitonsky I dunno for me they gave connection with others, like on old forums "Users online:"
@nikitonsky good one 👍!
For my AVR ASM stuff I prefer only two colours highlighted: labels and comments. On a white background.
@nikitonsky Has anyone made alabaster for emacs?

@nikitonsky yep yep. Some years ago I watched a talk by Douglas Crockford where, among other things, he discussed syntax highlighting, and conjured https://marketplace.visualstudio.com/items?itemName=darthspectrum.darkdoug for personal use.

It took some time to get used to but reading code became so comfortable.

I find the actual book analogy helpful here: we do not need different colors for verbs and nouns and so on to be able to read the text

Dark Doug - Visual Studio Marketplace

Extension for Visual Studio Code - A dark grayscale theme

@spectrum @nikitonsky The original talk was turned at some later point into a blog post. https://www.crockford.com/contextcoloring.html
The original was in the early 2000s, it may have been part of his 'good parts' book.
Context Coloring

@sleepyfox @nikitonsky I remember it being grayscale in the talk. Thanks a lot though!
@nikitonsky @siracusa Nice. I did similar changes with Solarized back in the day. One thing I do differently (and would like to offer as a suggestion) is to make numbers red so magic numbers stand out in a mildly alarming color.
@nikitonsky Ever since I discovered Alabaster, I can't go back.
@nikitonsky Highlighting keywords might be a habit picked up from Algol 60, which used a bold typeface to distinguish keywords (yes, compiler technology was that primitive - https://en.wikipedia.org/wiki/Stropping_(syntax) ). As LISP shows, there's no need to distinguish keywords.
Stropping (syntax) - Wikipedia

@nikitonsky
Bold works really well in light themes, to make any lighter colors stand out better.
@nikitonsky you really got me to properly look at the default theme in Xcode. **Great** post.

@nikitonsky @catppuccin would like to have a word with you lol

I'm using https://felipec.github.io/vim-felipec/ since quite sometime and I like it. Reason why I switched from fancy themes to this was because of the poor contrast in popular themes

vim-felipec

Vim color scheme: dark, bright, simple.

vim-felipec
Syntax highlighting is a waste of an information channel

No newsletter next week Running the TLA+ workshop. No way I'm gonna have any brainpower after that. Syntax highlighting is a waste of an information channel...

Computer Things

@tris @nikitonsky ”All variable identifiers we assign to twice”

About 15 years ago, I actually wrote a plugin for an IDE that did exactly that, because I needed to clean up code that was abusing variable reuse a lot.

@nikitonsky I don’t use dark mode because it looks better. I use it because I am a vampire and the light mode sears my eyes.

@nikitonsky Really interesting post. I've created an Alabaster port for the Nova editor, since there didn't seem to be one yet

https://github.com/jonclayden/Alabaster_Nova

GitHub - jonclayden/Alabaster_Nova: Alabaster, a minimal theme by Niki Tonsky, ported to Nova

Alabaster, a minimal theme by Niki Tonsky, ported to Nova - jonclayden/Alabaster_Nova

GitHub
@nikitonsky Very interesting article, I am in the process of adapting the dark theme for PhPStorm to my needs. I note all the same the irony of the article which advocates parsimony in the use of syntax highlighting, on a web page with such a bright background 🌞😎
@Dark_Chyper I mean, I don’t spend my whole day in my blog. I hope you don’t, either