1// Render key faces to PNGs (no hardware needed) so you can eyeball them before
2// pushing to the device. Writes to /tmp/face-preview/.
3import { mkdirSync, writeFileSync } from "node:fs";
4import sharp from "sharp";
5import { blank, lucide, mdi, txt } from "../src/icons.ts";
6
7const faces: Record<string, string> = {
8 blank: blank.svg,
9 metronome: mdi("metronome").svg,
10 "time-sig": lucide("Clock").svg,
11 bpm: txt("BPM").svg,
12 "add-instrument": lucide("Plus").svg,
13 record: lucide("Disc").fg("red").svg,
14 play: lucide("Play").svg,
15 save: lucide("Save").fg("green").svg,
16};
17
18const outDir = "/tmp/face-preview";
19mkdirSync(outDir, { recursive: true });
20
21for (const [name, face] of Object.entries(faces)) {
22 const png = await sharp(Buffer.from(face)).resize(118, 118).png().toBuffer();
23 const file = `${outDir}/${name}.png`;
24 writeFileSync(file, png);
25 console.info(`${name.padEnd(16)} ${png.length} bytes ${file}`);
26}