const path = require('path'); const fs = require('fs'); const { chromium } = require('playwright'); const OUT = path.join(__dirname, '..', 'public', 'icons'); const SVG = (bg) => ` R `; async function renderSvgToPng(svg, file, size) { const browser = await chromium.launch(); const page = await browser.newPage({ viewport: { width: size, height: size } }); await page.setContent(svg); await page.screenshot({ path: path.join(OUT, file), clip: { x: 0, y: 0, width: size, height: size } }); await browser.close(); console.log('Erzeugt:', file); } (async () => { fs.mkdirSync(OUT, { recursive: true }); await renderSvgToPng(SVG('#2563eb'), 'icon-192.png', 192); await renderSvgToPng(SVG('#2563eb'), 'icon-512.png', 512); await renderSvgToPng(SVG('#1e3a8a'), 'icon-maskable-512.png', 512); })();