I wrote a package that syntax-colors Roc code (Str -> List(Span)).
See https://github.com/showell/roc-syntax-color/blob/main/README.md
As with all my code, this is agent written under my supervision. Claude didn't take a ton of supervision to write a color syntax library, but I did ask for it to be fairly minimal (my taste). It's UPL and free to modify.
I use it in production for my little Roc book (see #contributing > a little Roc book). It's coming to my chat (see #show and tell > roc-chat) on the next deployment.
For a taste of the code see https://github.com/showell/roc-syntax-color/blob/main/package/RocSyntax.roc
It supports roc, zig, JS, and shale, and I'm taking requests for other languages.
Roc makes for pretty readable parsing code. Here's a little snippet:
## What a `{` opens, from the token before it.
brace_frame : Before -> Frame
brace_frame = |before| match before {
Dot => TypeBlock
Value | Equals | FatArrow | BarClose | Keyword => Body
Start | Colon | Arrow | BarOpen | Opener | Operator => Record
}
Note that Zulip lacks color syntax for Roc. :cry:
See it in action here (roc, js, shale, zig): https://roc.lynrummy.com/syntax-color/
C is now there as well.
See also https://roc.lynrummy.com/welcome-to-roc/
It requires a normal sized laptop/desktop monitor. It shows Roc color syntax for a real program.
I also added Odin and Python. I think language nerds will appreciate the code samples that I curated for those two languages. See the bottom of the roc-syntax-color example page.
Last updated: Nov 26 2026 at 20:35 UTC