I just shipped a small API that generates static images of
your GitHub contribution graph, and you can try it here.
My goal was graphs in TerminalWidget, but I
figured it would be useful in more places than that.
Why I built this
I wanted to show an activity graph in TerminalWidget.
The easiest path turned out to be pulling contribution data
from GitHub GraphQL and rendering the result as an image.
I looked around for an API that does this. I’m sure there’s
one (or more) out there, but I didn’t find them quickly
enough, and what I did find didn’t have the options I
needed.
What it does right now
The endpoint generates PNGs that look like GitHub profile
contribution charts, with a handful of color themes if you
want something other than the default look.
For now, this is intentionally focused: generate a chart
image quickly and keep the output predictable.
In addition to color themes, I included options for image
size (up to 4000px), number of months to show, and whether
or not to add captions.
There’s an API tester with live image preview at /contrib:
TerminalWidget example
Here is the command I use to generate a TerminalWidget
update:
If you’re already using TerminalWidget, this makes it dead
simple to drop your recent GitHub activity right into your
widget feed. If you want onto the TerminalWidget beta to try
it out, sign up here. The latest iOS build is available
now, and the matching macOS build is still waiting for
review but will work for this purpose (and many others).
What’s next
I may extend this with additional chart formats in the
future. For now, the goal was to get a solid GitHub-style
graph renderer up and running with useful customization.