HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
alecthomas
chroma
Go2017–2026
alecthomas / chroma

chroma

A general purpose syntax highlighter in pure Go

10Distinct people
11Mentions
0Explicit recommenders
5.1KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A general purpose syntax highlighter in pure Go

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year11 dated mentions

Observed mentions: 2017-09-18 15:43:59 UTC to 2026-01-04 14:52:18 UTC.

01232017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 3 mentions; 2 submissions, 1 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC321
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC000
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC211
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC211
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC202
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC000
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC000
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC000
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC101

What Hacker News says

11 sources
I did the same thing, but implemented my site generator in Go. My site has grown by a lot over the years, but I can still build it from scratch (from MD files, HTML snippets and static files) in less than one second! Also have a RSS feed generator and it can highlight code in most programming languages, which is important to me as I write posts on many languages. I did try Hugo before I went on to implement my own, and I got a few things from Hugo into mine, but Hugo just looked like far too overengineered for what I wanted (essentially, easy templating with markdown as the main language but able to include content from other files either in raw HTML or also markdown, with each file being able to define variables that can be used in the templating language which has support for the usual "expression language" constructs). I used the Go bu
Read the rest
ilt-in parser for the expression language so it was super easy to implement it! Used this for code syntax higlighting: https://github.com/alecthomas/chroma And this for markdown: https://github.com/russross/blackfriday The rest I implemented myself in simple to read Go code.
In Jeffgeerling.com has been migrated to Hugo
I've used a markdown to html converter to convert my blog posts into HTML with very nice and customizable code samples... in my case I used Go's Blackfriday library with bfchroma[1] doing syntax highlighting with Chroma[2]. To add your language to Chroma you have to provide a lexer, which in turn is written in Pygments[3] syntax. Once you have that, you can post your docs in GitHub Pages (or something like Netlify[4] or Cloudflare[5]), they both can run a command to build your website (from markdown to html) every time you push to a branch, and then serve the HTML generated as a static site. Before this though, your language seems similar enough to others (maybe Java or C#?) that if you tell the converter to use those languages, you'll get decent enough highlighting. I did this to highlight Zig code before it became supported by telling t
Read the rest
In Virgil: A fast and lightweight programming language that compiles to WASM
See also: Chroma (https://github.com/alecthomas/chroma) based on Pygments (https://pygments.org). JS libs like Highlight.js and Prisma.js can be ran server side and then you send the HTML/CSS like normal. Generally you'd want to pre-render blogs so syntax highlighting should be compiled HTML/CSS during the build process. CF workers and other edge computing work great if you have dynamic content if you don't want the client to use JS. For non-readonly, Monaco and Codemirror are available but heavier ofc. Anyone else know of another perf syntax highlighting lib? I like collecting tech.
In Show HN: Pure CSS/HTML C# syntax highlighting without JavaScript
> Why do Go articles so often have no syntax highlighting? Rob Pike, one of the 3 original Go architects, has stated in the past he doesn’t like syntax highlighting [1]. > Syntax highlighting is juvenile. When I was a child, I was taught arithmetic using colored rods (http://en.wikipedia.org/wiki/Cuisenaire_rods). I grew up and today I use monochromatic numerals. — Rob Pike Maybe Sergey Kamardin, the author of this article, is following Rob Pike’s philosophy. That being said, the website has references to a Go library called Chroma [2] which purpose is to colorize source code. The library borrows ideas from a popular JavaScript library called “highlight.js” [3] and that is why you can also see “highlight” CSS classes. The website downloads this CSS file [4] which contains a couple of instructions to make the code look the way it looks. Th
Read the rest
e official Go Blog has popularized this type of design [5] and many Go programmers has adopted it in their own websites. [1] https://groups.google.com/d/msg/golang-nuts/hJHCAaiL0so/kG3B... [2] https://github.com/alecthomas/chroma [3] https://highlightjs.org/ [4] https://gbws.io/scss/syntax.min.css [5] https://blog.golang.org/go-fonts
In Instrumentation in Go
Have a look at http://pygments.org/ or https://github.com/alecthomas/chroma where you can pass code into a library and it returns highlighted HTML. You can use Pygments in Java using Jython but its performance is questionable and can be incredibly slow when highlighting lisp code for example. Its a very edge case for most people, but seeing as I am working on a searchcode.com upgrade I need a fast highlighter. Currently I am spawning a background Go process using Chroma to take care of this for me, but if there was a decent Java library I would use it. None exist I am aware of that are even slightly up-to date.
In Love It or Hate It, Java Continues to Evolve

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.