|
| 1 | +/** |
| 2 | + * Generate logo.png from SVG for Google Search |
| 3 | + */ |
| 4 | + |
| 5 | +import fs from 'fs'; |
| 6 | +import path from 'path'; |
| 7 | +import { fileURLToPath } from 'url'; |
| 8 | + |
| 9 | +const __dirname = path.dirname(fileURLToPath(import.meta.url)); |
| 10 | +const publicDir = path.join(__dirname, '..', 'public'); |
| 11 | + |
| 12 | +// SVG logo at 512x512 - calculator design matching favicon |
| 13 | +const logoSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512"> |
| 14 | + <!-- Solid background for Google (no transparency) --> |
| 15 | + <rect width="512" height="512" fill="#07070a"/> |
| 16 | +
|
| 17 | + <!-- Rounded square accent background --> |
| 18 | + <rect x="56" y="56" width="400" height="400" rx="80" fill="#c4ff00"/> |
| 19 | +
|
| 20 | + <!-- Calculator body --> |
| 21 | + <rect x="128" y="96" width="256" height="320" rx="32" fill="#07070a"/> |
| 22 | +
|
| 23 | + <!-- Screen --> |
| 24 | + <rect x="152" y="120" width="208" height="80" rx="16" fill="#c4ff00"/> |
| 25 | +
|
| 26 | + <!-- Button row 1 --> |
| 27 | + <rect x="152" y="224" width="48" height="48" rx="8" fill="#3a3a3a"/> |
| 28 | + <rect x="232" y="224" width="48" height="48" rx="8" fill="#3a3a3a"/> |
| 29 | + <rect x="312" y="224" width="48" height="48" rx="8" fill="#c4ff00"/> |
| 30 | +
|
| 31 | + <!-- Button row 2 --> |
| 32 | + <rect x="152" y="296" width="48" height="48" rx="8" fill="#3a3a3a"/> |
| 33 | + <rect x="232" y="296" width="48" height="48" rx="8" fill="#3a3a3a"/> |
| 34 | + <rect x="312" y="296" width="48" height="48" rx="8" fill="#3a3a3a"/> |
| 35 | +
|
| 36 | + <!-- Button row 3 --> |
| 37 | + <rect x="152" y="368" width="128" height="32" rx="8" fill="#3a3a3a"/> |
| 38 | + <rect x="312" y="368" width="48" height="32" rx="8" fill="#c4ff00"/> |
| 39 | +</svg>`; |
| 40 | + |
| 41 | +// Save SVG version |
| 42 | +fs.writeFileSync(path.join(publicDir, 'logo.svg'), logoSvg); |
| 43 | +console.log('✓ Created logo.svg'); |
| 44 | + |
| 45 | +// Try to convert to PNG using sharp if available |
| 46 | +async function convertToPng() { |
| 47 | + try { |
| 48 | + const sharp = (await import('sharp')).default; |
| 49 | + const pngBuffer = await sharp(Buffer.from(logoSvg)) |
| 50 | + .resize(512, 512) |
| 51 | + .png() |
| 52 | + .toBuffer(); |
| 53 | + |
| 54 | + fs.writeFileSync(path.join(publicDir, 'logo.png'), pngBuffer); |
| 55 | + console.log('✓ Created logo.png (512x512)'); |
| 56 | + } catch (e) { |
| 57 | + console.log('Note: sharp not available, using SVG only'); |
| 58 | + console.log('To generate PNG, install sharp: npm install sharp'); |
| 59 | + console.log('Or use an online SVG to PNG converter'); |
| 60 | + } |
| 61 | +} |
| 62 | + |
| 63 | +convertToPng(); |
0 commit comments