mirror of
https://github.com/D-Modem/gui.git
synced 2026-11-28 22:30:49 -08:00
assets/dmodem.svg is now the D of D-Modem/brand's avatar/org-avatar.svg on the same dark tile, and tools/icons.js and icons.py made the Windows .ico and the macOS AppIcon set from it. The Linux app installs the SVG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRRhKGCaYUyYtH7Boap
21 lines
1.0 KiB
JavaScript
21 lines
1.0 KiB
JavaScript
// Renders assets/dmodem.svg (D-Modem/brand's mark, avatar/org-avatar.svg, on a tile) to the
|
|
// PNGs the apps' icons are made from, with Playwright's Chromium:
|
|
// node tools/icons.js && python3 tools/icons.py
|
|
const { chromium } = require('playwright');
|
|
const fs = require('fs'), path = require('path');
|
|
const root = path.join(__dirname, '..');
|
|
const svg = fs.readFileSync(path.join(root, 'assets', 'dmodem.svg'), 'utf8');
|
|
const out = path.join(root, 'build', 'icons');
|
|
fs.mkdirSync(out, { recursive: true });
|
|
(async () => {
|
|
const browser = await chromium.launch();
|
|
for (const size of [16, 32, 48, 64, 128, 256, 512, 1024]) {
|
|
const page = await browser.newPage({ viewport: { width: size, height: size } });
|
|
const s = svg.replace(/width="\d+" height="\d+"/, `width="${size}" height="${size}"`);
|
|
await page.setContent(`<html><body style="margin:0;background:transparent">${s}</body></html>`);
|
|
await page.screenshot({ path: path.join(out, `${size}.png`), omitBackground: true });
|
|
await page.close();
|
|
}
|
|
await browser.close();
|
|
})();
|