import fs from "node:fs/promises"; import path from "node:path"; import sharp from "sharp"; const root = path.resolve(process.cwd(), "mobile"); const assetsDir = path.join(root, "assets"); const COLORS = { bg: "#0B1220", gradA: "#22C55E", gradB: "#06B6D4", white: "#FFFFFF", }; function svgMonogram({ size, rounded = true, transparentBg = false }) { const corner = rounded ? Math.round(size * 0.22) : 0; const fontSize = Math.round(size * 0.52); const y = Math.round(size * 0.595); const background = transparentBg ? "" : ``; return Buffer.from( ` ${background} A `, ); } async function writePng({ svg, outPath }) { await fs.mkdir(path.dirname(outPath), { recursive: true }); await sharp(svg).png({ compressionLevel: 9 }).toFile(outPath); } async function main() { const iconSvg = svgMonogram({ size: 1024, rounded: true, transparentBg: false }); const splashSvg = svgMonogram({ size: 1024, rounded: true, transparentBg: false }); // Android adaptive icon foreground: transparent with extra padding const fgSize = 1024; const inner = 720; const pad = Math.floor((fgSize - inner) / 2); const adaptiveSvg = Buffer.from( ` A `, ); const faviconSvg = svgMonogram({ size: 48, rounded: true, transparentBg: false }); await Promise.all([ writePng({ svg: iconSvg, outPath: path.join(assetsDir, "icon.png") }), writePng({ svg: splashSvg, outPath: path.join(assetsDir, "splash-icon.png") }), writePng({ svg: adaptiveSvg, outPath: path.join(assetsDir, "adaptive-icon.png") }), writePng({ svg: faviconSvg, outPath: path.join(assetsDir, "favicon.png") }), ]); } await main();