// 临时脚本:从候选池选 100 个生成「画个标」logo 设计稿 HTML const fs = require('fs'); const path = require('path'); const ROOT = process.cwd(); const OUT = '_design-test'; const cands = JSON.parse(fs.readFileSync(path.join(OUT, 'candidates2.json'), 'utf8')); // 主题配额(共 100) const QUOTA = { design: 25, brand: 20, symbol: 18, tech: 12, commerce: 10, misc: 15 }; // 源优先级:经典线条在前,大库补充 const SRC_ORDER = ['feather', 'lucide', 'heroicons', 'iconoir', 'tabler', 'bootstrap', 'remix', 'phosphor', 'fluent', 'fluent-mdl2']; // 按主题分组 const byTheme = {}; cands.forEach(c => { (byTheme[c.theme] = byTheme[c.theme] || []).push(c); }); // 跨源轮选:每主题按源优先级轮流取,配额内 const picked = []; for (const [theme, n] of Object.entries(QUOTA)) { const pool = byTheme[theme] || []; // 每源分组 const perSrc = {}; pool.forEach(c => { (perSrc[c.source] = perSrc[c.source] || []).push(c); }); const rounds = Math.ceil(n / SRC_ORDER.length); let taken = 0; for (let r = 0; r < rounds && taken < n; r++) { for (const sid of SRC_ORDER) { const arr = perSrc[sid]; if (arr && arr.length > r) { picked.push(arr[r]); taken++; if (taken >= n) break; } } } // 配额未满则从剩余补 if (taken < n) { const rest = pool.filter(c => !picked.includes(c)); for (const c of rest) { if (taken >= n) break; picked.push(c); taken++; } } } console.log('选中 ' + picked.length + ' 个'); const srcStat = {}; picked.forEach(c => { srcStat[c.source] = (srcStat[c.source] || 0) + 1; }); console.log('来源分布:' + JSON.stringify(srcStat)); // 品牌配色(12 组,深底白图标) const PALETTES = [ ['#FF5A5F', '#FF2D55'], ['#FF9500', '#E66A00'], ['#FFD60A', '#E6B800'], ['#34C759', '#1F9D4F'], ['#00C7BE', '#009B94'], ['#0A84FF', '#0055D4'], ['#5E5CE6', '#3B36C7'], ['#FF375F', '#D40035'], ['#AF52DE', '#8E2BC7'], ['#30B0C7', '#1B7F94'], ['#8E8E93', '#48484A'], ['#111111', '#000000'] ]; // 徽章形状轮换:圆 / 圆角方 / 方 const SHAPES = ['round', 'squircle', 'square']; let cards = ''; picked.forEach((c, i) => { const [c1, c2] = PALETTES[i % PALETTES.length]; const shape = SHAPES[i % SHAPES.length]; const grad = `linear-gradient(135deg, ${c1} 0%, ${c2} 100%)`; const chip = `background:${c1};`; cards += `
${c.svg}
画个标
DrawLogo
${c.theme} ${c.source}:${c.id}
${c.license}${c.licenseNote ? ' · ' + c.licenseNote : ''}
`; }); const html = ` 画个标 · 100 个 LOGO 候选设计稿(外部调取测试)

画个标 · 100 个 LOGO 候选设计稿

数据来源:画个标共享图标库(manifest/icons.json)· 指令四「跨项目调取」测试 · 每稿含来源与协议标注
${cards}
`; fs.writeFileSync(path.join(OUT, '100-logos.html'), html, 'utf8'); fs.writeFileSync(path.join(OUT, 'picked.json'), JSON.stringify(picked.map(c => ({ theme: c.theme, source: c.source, id: c.id, name: c.name, license: c.license })), null, 1), 'utf8'); console.log('✅ 生成 ' + OUT + '/100-logos.html(' + picked.length + ' 稿)');