@grovemotorco/livery-cli
v1.0.0
Published
Generate shareable images of source code from the command line
Readme
@grovemotorco/livery-cli
Turn source code into shareable images from the command line. No browser, no network, no headless Chrome — the renderer is SVG and the rasterizer is resvg compiled to WASM, both bundled.
npm install -g @grovemotorco/livery-cli
livery render src/main.rs -o hero.pngOr without installing:
npx @grovemotorco/livery-cli render src/main.rs -o hero.pngUsage
livery render <file...> [options]
livery render --stdin --lang ts -o out.png
livery themes | languages | fonts | backgrounds [--json]
livery initRender several files at once with --out-dir, pipe a single image to stdout
with -o -, or put it straight on the clipboard with --copy:
livery render src/*.ts --out-dir ./shots --scale 3
livery render app.py -o - -f svg > app.svg
livery render snippet.go --copyOptions
| Flag | What it does |
| ---------------------------------- | ---------------------------------------------------------- |
| -o, --out <path> | Output file for a single input; - means stdout |
| -d, --out-dir <dir> | Output directory, for any number of inputs |
| -f, --format <png\|svg> | Defaults to png |
| -s, --scale <1-4> | Defaults to 2 |
| --copy | Copy the PNG to the clipboard |
| --lang <id> | Language; inferred from the file extension otherwise |
| --theme <id\|file> | Built-in theme id, or a path to a theme JSON |
| --font <id> | One of the six bundled families |
| --bg <preset\|#hex\|none\|image> | Backdrop; a file path is embedded |
| --ratio <r> | auto, 1:1, 4:3, 3:2, 16:9, 1.91:1, 9:16 |
| --line-numbers | Show line numbers |
| --highlight <3,5-8> | Band those lines |
| --focus <3,5-8> | Keep those bright, dim the rest |
| --config <file> | Defaults file; the nearest livery.config.json by default |
| --preset <name> | Named preset from the config file |
| --remote <url> | Render via a deployed API instead of locally |
livery --help lists the rest — window chrome, shadows, padding, noise,
watermarks and line height.
Precedence: flags beat presets, presets beat the config file, the config file beats defaults.
Configuration
livery init writes a livery.config.json you can keep beside a project:
{
"theme": "vitesse-dark",
"font": { "family": "jetbrains-mono", "size": 14 },
"window": { "controls": "mac", "radius": 12 },
"frame": {
"padding": { "x": 48, "y": 48 },
"background": { "type": "preset", "id": "aurora" }
},
"presets": {
"og": {
"frame": { "aspectRatio": "1.91:1", "width": 1200 }
},
"docs": {
"window": { "show": false },
"frame": { "background": { "type": "none" }, "padding": { "x": 24, "y": 24 } }
}
}
}Everything outside presets is the baseline; each key inside presets is a
named override you select with --preset:
livery render src/lib.rs --preset og -o docs/hero.pngWhat ships
The published package is one bundled ESM file plus the assets it reads at
runtime, so nothing is resolved out of node_modules at render time:
dist/cli.js the CLI, with @grovemotorco/livery-core inlined
dist/resvg.wasm the rasterizer
dist/assets/ Shiki grammars and themes, imported on demand
fonts/ six OFL monospace families, as TTF
backdrops/ the bundled wallpapersIts only runtime dependency is @resvg/resvg-wasm.
Fonts are vendored as TTF rather than WOFF2 because resvg's font parser cannot decompress WOFF2 — the same files serve the browser and the rasterizer, which is what keeps an export identical to its preview.
Requirements
Node.js 20 or newer.
Related
@grovemotorco/livery-core— the renderer, if you want to embed it- Source and the hosted editor
Licence
MIT. Bundled fonts are OFL 1.1 and ship their own LICENSE.txt beside the TTFs,
resvg.wasm is MPL-2.0, and the Grove Motor Co wallpapers and marks are not
covered by the MIT grant — see
LICENSE.
