import { mkdirSync, writeFileSync } from 'node:fs'; import path from 'node:path'; const repoRoot = process.cwd(); const outputDir = path.join( repoRoot, 'public', 'branding', 'taonier-logo-squish-variants', ); const variants = [ { id: 'taonier-squish-berry-mint', title: '莓果薄荷', topStart: '#ff4778', topEnd: '#ff6b5f', bottomStart: '#12c9b7', bottomEnd: '#16b899', starStart: '#ffd54c', starEnd: '#ffb82e', accent: '#ffc545', background: '#fffaf2', }, { id: 'taonier-squish-candy-pop', title: '糖果桃青', topStart: '#ff5fa2', topEnd: '#ff8670', bottomStart: '#2ed7c5', bottomEnd: '#65d8f4', starStart: '#ffe06f', starEnd: '#ffbf4d', accent: '#ffce5e', background: '#fff8fb', }, { id: 'taonier-squish-jelly-cream', title: '奶油果冻', topStart: '#ff758d', topEnd: '#ff9a70', bottomStart: '#42d6b5', bottomEnd: '#7ce3c5', starStart: '#fff07a', starEnd: '#ffc955', accent: '#ffd76a', background: '#fffdf4', }, { id: 'taonier-squish-bubble-bright', title: '亮彩泡泡', topStart: '#ff3f8f', topEnd: '#ff6d6d', bottomStart: '#00c2b8', bottomEnd: '#00d69a', starStart: '#fff15c', starEnd: '#ffbe35', accent: '#ffbd3c', background: '#fdfcff', }, { id: 'taonier-squish-sunny-coral', title: '暖日珊瑚', topStart: '#ff684f', topEnd: '#ff8d67', bottomStart: '#22c4a8', bottomEnd: '#4dd9b5', starStart: '#ffe36d', starEnd: '#ffb948', accent: '#ffc04a', background: '#fff8ed', }, { id: 'taonier-squish-neon-cute', title: '霓虹可爱', topStart: '#ff3d7f', topEnd: '#ff4fb8', bottomStart: '#00bfae', bottomEnd: '#00d2ff', starStart: '#fff16a', starEnd: '#ffd13d', accent: '#ffcf45', background: '#fbfbff', }, ]; function buildLogoSvg(variant, includeLabel = false) { const labelHeight = includeLabel ? 72 : 0; const height = 1024 + labelHeight; const labelMarkup = includeLabel ? ` ${variant.title}` : ''; return ` ${labelMarkup} `; } function buildContactSheetSvg() { const cell = 320; const label = 64; const gap = 28; const width = cell * 3 + gap * 4; const height = (cell + label) * 2 + gap * 3; const items = variants .map((variant, index) => { const row = Math.floor(index / 3); const col = index % 3; const x = gap + col * (cell + gap); const y = gap + row * (cell + label + gap); const logo = buildLogoSvg(variant) .replace(/<\?xml[^>]+>\n/u, '') .replace('', ``); return `${logo} ${String(index + 1).padStart(2, '0')} ${variant.title}`; }) .join('\n'); return ` ${items} `; } mkdirSync(outputDir, { recursive: true }); for (const variant of variants) { writeFileSync( path.join(outputDir, `${variant.id}.svg`), buildLogoSvg(variant), 'utf8', ); } writeFileSync( path.join(outputDir, 'taonier-squish-variants-contact-sheet.svg'), buildContactSheetSvg(), 'utf8', ); console.log( JSON.stringify( { ok: true, outputDir, files: [...variants.map((variant) => `${variant.id}.svg`), 'taonier-squish-variants-contact-sheet.svg'], }, null, 2, ), );