feat(brand): adopt the new M↓ brand kit; fix CI tool downloads

Branding:
- All app icons regenerated from the new vector brand kit (M↓ mark):
  icon.png/icon@2x (app + packaging), favicon.png, tray-icon.png, and the
  full assets/icons/ size set — generate-icons.js now rasterizes
  app-icon.svg directly (docico1.png removed)
- index.html gets proper favicon/apple-touch links from the kit
- Welcome tab hero shows the new mark; README gets the horizontal wordmark
- assets/logo.png (ConcreteInfo) intentionally untouched

CI release fixes (win/mac jobs were failing):
- FiraCode download moved from moving raw/master URLs (hash drifted
  upstream, tripping the pin) to the immutable 6.2 release asset; repo
  fonts updated to the pinned 6.2 bits
- macOS pandoc extractor locates the binary in the archive instead of
  assuming a bin/ layout that the macOS zip doesn't have

Stray upload archive (markdown-converter-assets (1).zip) excluded.
This commit is contained in:
2026-09-05 23:10:15 +05:30
parent 0be46d4bac
commit 77f8ba3d9d
47 changed files with 327 additions and 75 deletions
+44 -50
View File
@@ -1,78 +1,72 @@
/**
* Icon Generator for MarkdownConverter
* Generates all required icon sizes from NewIcon.jpg
*
* Rasterizes the brand kit's vector app icon (the "M↓" mark,
* assets/markdown-converter-assets/app-icon.svg) into every size the app and
* its packaging need:
*
* assets/icon.png 512×512 — app icon (electron-builder converts to
* .ico/.icns for Windows/macOS from this)
* assets/icon@2x.png 1024×1024 — hi-dpi variant
* assets/favicon.png 32×32 — in-app/browser favicon
* assets/tray-icon.png 24×24 — system tray
* assets/icons/* 16…1024 — multi-size set (ico/icns input)
*
* assets/logo.png is NOT touched — that is the ConcreteInfo logo used in the
* app header and About dialog.
*/
const sharp = require('sharp');
const fs = require('fs');
const path = require('path');
// Source image
const sourceImage = path.join(__dirname, '..', 'assets', 'docico1.png');
// Brand kit sources (vector, primary)
const brandDir = path.join(__dirname, '..', 'assets', 'markdown-converter-assets');
const sourceSvg = path.join(brandDir, 'app-icon.svg');
const assetsDir = path.join(__dirname, '..', 'assets');
// Icon sizes needed for different platforms
const iconSizes = [16, 24, 32, 48, 64, 128, 256, 512, 1024];
async function generateIcons() {
console.log('Generating icons from docico1.png...');
/**
* Rasterize the SVG source at a given size. `density` scales the vector so
* small renders stay crisp; the explicit resize guarantees exact dimensions.
*/
async function renderIcon(size, outPath) {
await sharp(sourceSvg, { density: Math.max(72, Math.round((size / 512) * 384)) })
.resize(size, size, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } })
.png()
.toFile(outPath);
console.log(`Generated ${path.relative(process.cwd(), outPath)} (${size}x${size})`);
}
// Check if source exists
if (!fs.existsSync(sourceImage)) {
console.error('Source image not found:', sourceImage);
async function generateIcons() {
console.log('Generating icons from the brand kit (app-icon.svg)...');
if (!fs.existsSync(sourceSvg)) {
console.error('Brand source not found:', sourceSvg);
process.exit(1);
}
try {
// Generate main icon.png (512x512)
await sharp(sourceImage)
.resize(512, 512, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } })
.png()
.toFile(path.join(assetsDir, 'icon.png'));
console.log('Generated icon.png (512x512)');
// Main app icons consumed by main.js windows and electron-builder
await renderIcon(512, path.join(assetsDir, 'icon.png'));
await renderIcon(1024, path.join(assetsDir, 'icon@2x.png'));
// Generate icon@2x.png (1024x1024)
await sharp(sourceImage)
.resize(1024, 1024, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } })
.png()
.toFile(path.join(assetsDir, 'icon@2x.png'));
console.log('Generated icon@2x.png (1024x1024)');
// Favicon + tray
await renderIcon(32, path.join(assetsDir, 'favicon.png'));
await renderIcon(24, path.join(assetsDir, 'tray-icon.png'));
// Create icons directory for multi-size icons
// Multi-size set for packaging converters (ico/icns)
const iconsDir = path.join(assetsDir, 'icons');
if (!fs.existsSync(iconsDir)) {
fs.mkdirSync(iconsDir, { recursive: true });
}
// Generate all sizes
fs.mkdirSync(iconsDir, { recursive: true });
for (const size of iconSizes) {
await sharp(sourceImage)
.resize(size, size, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } })
.png()
.toFile(path.join(iconsDir, `${size}x${size}.png`));
console.log(`Generated icons/${size}x${size}.png`);
await renderIcon(size, path.join(iconsDir, `${size}x${size}.png`));
}
// Generate favicon
await sharp(sourceImage)
.resize(32, 32, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } })
.png()
.toFile(path.join(assetsDir, 'favicon.png'));
console.log('Generated favicon.png (32x32)');
// Generate tray icon (smaller, for system tray)
await sharp(sourceImage)
.resize(24, 24, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } })
.png()
.toFile(path.join(assetsDir, 'tray-icon.png'));
console.log('Generated tray-icon.png (24x24)');
console.log('\nIcon generation complete!');
console.log('\nFor Windows .ico file, use an online converter or:');
console.log(' magick convert assets/icons/*.png assets/icon.ico');
console.log('\nFor macOS .icns file, use:');
console.log(' iconutil -c icns assets/icon.iconset -o assets/icon.icns');
console.log('Windows .ico and macOS .icns are generated automatically by');
console.log('electron-builder from assets/icon.png during packaging.');
} catch (error) {
console.error('Error generating icons:', error);
process.exit(1);