Add favicon: M monogram on green background
SVG master + PNG exports at 16x16, 32x32 and 180x180 (Apple touch icon). Generated via puppeteer from favicon.svg. Wired into <head> and Dockerfile. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
40
generate-favicons.js
Normal file
40
generate-favicons.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const puppeteer = require('puppeteer-core');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const CHROME = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe';
|
||||
const SVG = fs.readFileSync(path.join(__dirname, 'favicon.svg'), 'utf8');
|
||||
|
||||
const sizes = [
|
||||
{ name: 'favicon-16x16.png', px: 16 },
|
||||
{ name: 'favicon-32x32.png', px: 32 },
|
||||
{ name: 'apple-touch-icon.png', px: 180 },
|
||||
];
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch({
|
||||
executablePath: CHROME,
|
||||
headless: 'new',
|
||||
args: ['--no-sandbox'],
|
||||
});
|
||||
|
||||
const page = await browser.newPage();
|
||||
|
||||
for (const { name, px } of sizes) {
|
||||
await page.setViewport({ width: px, height: px, deviceScaleFactor: 1 });
|
||||
await page.setContent(`<!DOCTYPE html>
|
||||
<html><head><style>
|
||||
*{margin:0;padding:0;background:transparent}
|
||||
body{width:${px}px;height:${px}px;overflow:hidden}
|
||||
img{width:${px}px;height:${px}px}
|
||||
</style></head><body>
|
||||
<img src="data:image/svg+xml;base64,${Buffer.from(SVG).toString('base64')}">
|
||||
</body></html>`);
|
||||
await page.waitForNetworkIdle();
|
||||
const out = path.join(__dirname, name);
|
||||
await page.screenshot({ path: out, clip: { x: 0, y: 0, width: px, height: px }, omitBackground: true });
|
||||
console.log(`OK ${name} (${px}x${px})`);
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
})();
|
||||
Reference in New Issue
Block a user