Files
gui/tools/icons.js
T
Claude f62777b994 Windows and macOS apps, the app icon, and terminal fixes
- windows/: the Windows app in plain Win32 C++ (ANSI APIs, Win95
  common controls, Winsock 1.1), so that it runs on Windows 95 and
  later: Modem, Terminal, Settings, Call Stats and Log pages over
  libdmodemctl.  dmodemd is started where Windows can run it; on 9x
  the app reaches a modem over TCP or a COM port.  build-watcom.sh
  builds it with Open Watcom; CMake builds it with MinGW or MSVC.
- macos/: the SwiftUI app (XcodeGen project), with the terminal drawn
  from libdmodemctl's screen, the SIP password in the keychain.
- The app icon (assets/dmodem.svg, from the brand's jack art) as .ico
  and an asset catalogue, by tools/icons.js and tools/icons.py.
- libdmodemctl: anonymous enums (Swift imports them as constants),
  Backspace as BS (the modem's S5), key table without designated
  initialisers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRVTPinTtLUajudobBC
2026-11-06 13:53:21 +00:00

21 lines
1.0 KiB
JavaScript

// Renders assets/dmodem.svg (D-Modem/brand's app icon 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();
})();