snapcode

CLI

CLI

Install it globally:

install
npm i -g snapcode

Basic usage:

getsnapcode generate --file app.ts --out card.png

Flags

--file <path>Source file to render. Use - to read from stdin (requires --lang).
--theme <name>Theme: github-dark, dracula, nord, github-light, one-light, solarized-light.
--font <name>Font family. This build ships jetbrains-mono.
--bg <name>Background: none, midnight, sunset, lagoon, candy, graphite, paper, sky.
--lines <range>Show only a line range, e.g. 5-12.
--highlight <lines>Emphasize lines and dim the rest, e.g. 3,7-9.
--diff <marks>Manual diff marks, e.g. added:1-2,removed:5.
--line-numbersShow line numbers.
--title <text>Window title shown in the chrome bar.
--format <format>png or svg (default png).
--scale <n>PNG scale: 1, 2, or 3 (default 2).
--out <path>Output path. Use - for stdout. Default: snapcode-<timestamp>.<format>.
--lang <id>Language override. Required when reading from stdin.
--apiRender server-side via the hosted API. Requires snapcode login + Pro.
--theme <preset>When logged in, --theme also accepts your saved cloud preset names (e.g. my-brand).

Examples

~/code/api — zsh
getsnapcode generate --file app.ts --theme dracula --bg candy --scale 3
getsnapcode generate --file app.py --lines 10-25 --highlight 12,18 --line-numbers
getsnapcode generate --file app.go --diff added:3-5,removed:8 --title "fix: retry loop"
cat query.sql | getsnapcode generate --file - --lang sql --out - > query.png

Account

getsnapcode loginOpens the browser to authorize this machine; stores an API key in ~/.config/snapcode.
getsnapcode whoamiShows the logged-in account id and plan.
getsnapcode logoutRemoves the stored API key.

Logged-in Pro accounts: local renders drop the watermark, --theme accepts cloud preset names, and --api renders server-side. Logged out, everything works offline with the default watermark.