frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Doing my own syntax highlighting (finally)

https://alexwlchan.net/2025/syntax-highlighting/
29•speckx•6d ago

Comments

epage•10h ago
I kind of like it as it shifts the focus from syntax to logic. In futherance of that framing, some changes I'd include

- make all literals the same color

- make uses of defined items colored as a lighter color of the definition

- still color conditionals and loops

- use JS to have hovering over an item to highlight all other uses

skydhash•10h ago
A more sensible text related to code presentation is Rougier's On the design of text editors. But I found I don't really need a lot of syntax highlighting. My preference is towards those separations:

- Code vs comments - builtins vs other symbols - maybe strings.

But I like to rely on whitespace (blank lines and indentations) more than colors these days.

[0]: https://arxiv.org/abs/2008.06030

foofoo12•10h ago
> he suggests colouring just a few key elements, like strings, comments, and variable definitions. I don’t know if that would work for everybody, but I like the idea

I don't like this trend copying at all. The post he's referring to is probably written by someone with light sensitivity.

Terr_•9h ago
> Syntax highlighting is mostly a matter of taste

To quibble a bit: Color choice is mostly a matter of taste, but highlighting itself is a matter of workflows. Highlighting syntax in particular just happens to be a default most people find acceptable.

In other circumstances, the user may benefit from coloring by variable data-type, or coloring by distinct variable name, or coloring by scope, etc. Often IDEs will keep the font color, and use other channels like a highlight-box around some text, or gutter-icons.

teo_zero•9h ago
I like the concept. I don't buy all the author's personal choices, though.

I think the highlighting should serve 2 purposes: 1. help you parse the code, and 2. put more or less emphasis on some elements.

Comments have a primary role when reading someone's code, so they deserve a distinguished color by virtue of point 2 above.

Strings are sometimes difficult to parse correctly because the symbol to start them is the same to end them, so item 1 above applies.

And variable definitions have the tendency of hiding in plain sight, despite being crucial to understand a piece of code, so they match both criteria 1 and 2.

But numbers, booleans and constants can't be possibly mistaken for anything else, nor do they need to stand out more than the rest, so why highlighting them?

Deemphasizing punctuation might be a good idea: I'd probably reserve the same treatment to some common boilerplates, too, like #include in C/C++, #[derive] in Rust, etc.

Finally many languages make it hard to tell types and variables apart. Therefore I'd argue that types deserve their own coloring, obeying reason 1 above.

To add a final nitpick, the two "use" statements in the example define two symbols, "FilterType" and "Error". I think only these two words should be highlighted in blue, not the rest of the hierarchy.

anonymous908213•9h ago
I've long felt this whole concept is a waste of time. I've been using a very simple rule since shortly after I started programming: comments are green. That's it. That's the rule. Distinguish code from stuff that isn't code, and otherwise just read the damn thing. No highlighting at all would be fine too. Playing games with rainbows makes everything take more effort to read, not less. You ever notice how you do just fine parsing syntax intuitively and subconsciously as, for example, you're reading this paragraph? We already spend our entire lives training the skill of instantly understanding syntax when reading un-highlighted text.

Keep Android Open

http://keepandroidopen.org/
746•LorenDB•5h ago•186 comments

Tips for stroke-surviving software engineers

https://blog.j11y.io/2025-10-29_stroke_tips_for_engineers/
184•padolsey•5h ago•46 comments

What we talk about when we talk about sideloading

https://f-droid.org/2025/10/28/sideloading.html
1108•rom1v•15h ago•477 comments

Who needs Graphviz when you can build it yourself?

https://spidermonkey.dev/blog/2025/10/28/iongraph-web.html
116•pdubroy•4h ago•12 comments

ChatGPT's Atlas: The Browser That's Anti-Web

https://www.anildash.com//2025/10/22/atlas-anti-web-browser/
307•AndrewDucker•4d ago•126 comments

uBlock Origin Lite Apple App Store

https://apps.apple.com/in/app/ublock-origin-lite/id6745342698
140•mumber_typhoon•5h ago•49 comments

SpiderMonkey Garbage Collector

https://firefox-source-docs.mozilla.org/js/gc.html
5•sebg•21m ago•0 comments

EuroLLM: LLM made in Europe built to support all 24 official EU languages

https://eurollm.io/
639•NotInOurNames•18h ago•470 comments

Powerful and precise multi-color lasers now fit on a single chip

https://phys.org/news/2025-10-powerful-precise-multi-lasers-chip.html
18•PaulHoule•4d ago•4 comments

Wacl – A Tcl Distribution for WebAssembly

https://github.com/ecky-l/wacl
37•shakna•5h ago•2 comments

Tinkering is a way to acquire good taste

https://seated.ro/blog/tinkering-a-lost-art
286•jxmorris12•11h ago•205 comments

Boring is what we wanted

https://512pixels.net/2025/10/boring-is-what-we-wanted/
317•Amorymeltzer•13h ago•179 comments

UIs Are Not Pure Functions of the Model – React.js and Cocoa Side by Side (2018)

https://blog.metaobject.com/2018/12/uis-are-not-pure-functions-of-model.html
11•PKop•3d ago•1 comments

Generative AI Image Editing Showdown

https://genai-showdown.specr.net/image-editing
244•gaws•12h ago•48 comments

Project Shadowglass

https://shadowglassgame.com
82•layer8•8h ago•29 comments

Gluing and framing a 9000-piece jigsaw

https://river.me/blog/puzzle-glue-9000/
51•busymom0•3d ago•13 comments

The AirPods Pro 3 flight problem

https://basicappleguy.com/basicappleblog/the-airpods-pro-3-flight-problem
417•andrem•19h ago•234 comments

Keeping the Internet fast and secure: introducing Merkle Tree Certificates

https://blog.cloudflare.com/bootstrap-mtc/
136•tatersolid•10h ago•41 comments

Apple will phase out Rosetta 2 in macOS 28

https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment
146•summarity•5d ago•142 comments

HTTPS by default

https://security.googleblog.com/2025/10/https-by-default.html
204•jhalderm•15h ago•176 comments

Fil-C: A memory-safe C implementation

https://lwn.net/SubscriberLink/1042938/658ade3768dd4758/
210•chmaynard•16h ago•67 comments

Why do some radio towers blink?

https://www.jeffgeerling.com/blog/2025/why-do-some-radio-towers-blink
150•warrenm•13h ago•98 comments

Nvidia takes $1B stake in Nokia

https://www.cnbc.com/2025/10/28/nvidia-nokia-ai.html
207•kjhughes•17h ago•134 comments

We need a clearer framework for AI-assisted contributions to open source

https://samsaffron.com/archive/2025/10/27/your-vibe-coded-slop-pr-is-not-welcome
249•keybits•22h ago•133 comments

Mapping the off-target effects of every FDA-approved drug in existence

https://www.owlposting.com/p/mapping-the-off-target-effects-of
139•abhishaike•15h ago•28 comments

The decline of deviance

https://www.experimental-history.com/p/the-decline-of-deviance
173•zdw•17h ago•145 comments

Using AI to negotiate a $195k hospital bill down to $33k

https://www.threads.com/@nthmonkey/post/DQVdAD1gHhw
939•stevenhubertron•17h ago•810 comments

Ubiquiti SFP Wizard

https://blog.ui.com/article/welcome-to-sfp-liberation-day
232•eXpl0it3r•19h ago•171 comments

Notes on Waveguide Synthesis (2018)

https://www.osar.fr/notes/waveguides/
20•jstrieb•6d ago•1 comments

Our LLM-controlled office robot can't pass butter

https://andonlabs.com/evals/butter-bench
196•lukaspetersson•19h ago•105 comments