diff --git a/scripts/generate-icons.ts b/scripts/generate-icons.ts index 2d82949..00a9999 100644 --- a/scripts/generate-icons.ts +++ b/scripts/generate-icons.ts @@ -9,6 +9,12 @@ const root: string = resolve(scriptDir, ".."); const svgBuffer: Buffer = readFileSync(resolve(root, "public/icons/icon.svg")); +/** Theme background matching `theme_color` / icon.svg fill (`#1a1a2e`). */ +const THEME_BG = { r: 0x1a, g: 0x1a, b: 0x2e, alpha: 1 }; + +const density = 512; +const publicDir = resolve(root, "public"); + const pngIcons: Array<{ name: string; size: number }> = [ { name: "icons/apple-touch-icon.png", size: 180 }, { name: "icons/icon-192.png", size: 192 }, @@ -37,7 +43,7 @@ writeFileSync(faviconDest, icoBuffer); /** Branded placeholder screenshots for the Web App Manifest `screenshots` member. */ async function writeScreenshot(width: number, height: number, file: string): Promise { const iconSize = Math.round(Math.min(width, height) * 0.4); - const icon = await sharp(svg, { density }).resize(iconSize, iconSize).png().toBuffer(); + const icon = await sharp(svgBuffer, { density }).resize(iconSize, iconSize).png().toBuffer(); await sharp({ create: { width,