// Renders brand/graphley-icon.svg (the "Stacked tide" icon, same file as graphley-site/mark.svg) to every // app icon PNG. Uses Chromium through Playwright, because ImageMagick's built-in SVG renderer once dropped // the old icon's gradient and line and shipped a black square with a dot. // Run from the repository root: node scripts/render-icons.js const fs = require('fs'); const path = require('path'); const { chromium } = require('playwright'); const root = path.resolve(__dirname, '..'); const svg = fs.readFileSync(path.join(root, 'brand/graphley-icon.svg'), 'utf8').replace(' { const body = size * 824 / 1024, radius = body * 0.225; return `
${svg}
`; }; // iOS: full-bleed opaque square, the system applies the mask. const square = (size) => `
${svg}
`; (async () => { const browser = await chromium.launch(process.env.PW_CHROME ? { executablePath: process.env.PW_CHROME } : {}); const shot = async (html, size, file, transparent = true) => { const page = await browser.newPage({ viewport: { width: size, height: size } }); await page.setContent(html); await page.screenshot({ path: path.join(root, file), omitBackground: transparent }); await page.close(); }; for (const size of [16, 32, 64, 128, 256, 512, 1024]) { await shot(mac(size), size, `Apps/Mac/Assets.xcassets/AppIcon.appiconset/icon-${size}.png`); } await shot(square(1024), 1024, 'Apps/iPhone/Assets.xcassets/AppIcon.appiconset/icon-1024.png', false); await shot(mac(1024), 1024, 'brand/graphley-icon-1024.png'); await shot(square(1024), 1024, 'brand/graphley-icon-1024-opaque.png', false); await browser.close(); })();