const sharp = require('sharp'); const fs = require('fs'); const path = require('path'); const resourcesDir = path.join(__dirname, '../resources'); // 创建一个简单的蓝色渐变图标 async function createIcon() { const size = 512; // 创建渐变背景 const svg = ` W `; // 生成 PNG await sharp(Buffer.from(svg)) .resize(512, 512) .png() .toFile(path.join(resourcesDir, 'icon.png')); console.log('✓ Generated icon.png (512x512)'); // 生成小尺寸图标 for (const s of [256, 128, 64, 32, 16]) { await sharp(path.join(resourcesDir, 'icon.png')) .resize(s, s) .png() .toFile(path.join(resourcesDir, `icon-${s}.png`)); console.log(`✓ Generated icon-${s}.png`); } console.log('\nIcons generated successfully!'); } createIcon().catch(console.error);