const pptxgen = require('pptxgenjs'); const path = require('path'); const fs = require('fs'); const html2pptx = require('./.claude/skills/pptx/scripts/html2pptx.js'); // Tingting's signature color palette + celebration touches const colors = { primary: '#6B2C3E', // Bordeaux profond accent: '#B8974F', // Or antique background: '#F5F1E8', // Crème ivoire celebration: '#E8B4B8', // Rose doux pour anniversaire warm: '#D4AF37', // Or chaud pour bougies text: '#2C1810' // Brun foncé pour lisibilité }; // CSS shared styles const sharedStyles = ` * { margin: 0; padding: 0; box-sizing: border-box; } body { width: 960px; height: 540px; margin: 0; padding: 0; overflow: hidden; } .slide { width: 960px; height: 540px; position: relative; font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif; overflow: hidden; } .bg-primary { background: ${colors.primary}; } .bg-warm { background: ${colors.background}; } .bg-celebration { background: ${colors.celebration}; } .title-main { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: 90%; } .title-main h1 { font-size: 48px; color: ${colors.background}; margin-bottom: 20px; font-weight: 700; letter-spacing: 2px; } .title-main .subtitle { font-size: 24px; color: ${colors.celebration}; font-weight: 300; } .title-main .class-info { font-size: 20px; color: ${colors.accent}; margin-top: 15px; font-weight: 400; } .content-slide { padding: 50px 70px 60px 70px; } .content-slide h2 { font-size: 32px; color: ${colors.primary}; margin-bottom: 25px; font-weight: 700; } .content-slide p { font-size: 20px; line-height: 1.8; color: ${colors.text}; margin-bottom: 15px; } .content-slide ul { margin-left: 40px; margin-top: 20px; } .content-slide li { font-size: 18px; line-height: 1.8; color: ${colors.text}; margin-bottom: 8px; } .quote-box { background: white; padding: 25px 30px; margin: 25px 0; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); } .quote-box p { font-size: 22px; color: ${colors.primary}; font-style: italic; line-height: 1.6; } .number-highlight { display: inline-block; background: ${colors.accent}; color: white; padding: 5px 15px; border-radius: 20px; font-weight: bold; font-size: 24px; } .decoration-top { position: absolute; top: 0; right: 0; width: 200px; height: 200px; background: ${colors.accent}40; opacity: 0.3; border-radius: 50%; } .decoration-bottom { position: absolute; bottom: 0; left: 0; width: 150px; height: 150px; background: ${colors.celebration}40; opacity: 0.3; border-radius: 50%; } .v-center { position: absolute; top: 50%; transform: translateY(-50%); width: 100%; padding: 0 60px; } .section-title { background: ${colors.primary}; display: flex; align-items: center; justify-content: center; } .section-title h2 { font-size: 48px; color: ${colors.background}; text-align: center; font-weight: 700; padding: 0; } `; // Slide templates const slides = [ // Slide 1: Title `
`, // Slide 2: Opening ``, // Slide 3: 373 Days ``, // Slide 4: Section title ``, // Slide 5: Welcome Birthday Stars ``, // Slide 6: Meaning of Birthdays ``, // Slide 7: Surprise (TYPO FIXED) ``, // Slide 8: Hosts' Birthday ``, // Slide 9: Growing Together (OPTIMIZED) ``, // Slide 10: Making a Wish ``, // Slide 11: Blow Candles ``, // Slide 12: Gifts ``, // Slide 13: Interactive Blessings ``, // Slide 14: Gratitude to Parents ``, // Slide 15: Birthday Wishes (TYPO FIXED: 住→祝) ``, // Slide 16: Class Photo ``, // Slide 17: Looking Forward ``, // Slide 18: Thank You `` ]; // Create HTML files for each slide function createHTMLFiles() { const slideDir = path.join(__dirname, 'birthday_slides'); if (!fs.existsSync(slideDir)) { fs.mkdirSync(slideDir); } slides.forEach((slideContent, index) => { const htmlContent = ` ${slideContent} `; const filename = path.join(slideDir, `slide_${index + 1}.html`); fs.writeFileSync(filename, htmlContent, 'utf-8'); console.log(`✓ Created: slide_${index + 1}.html`); }); return slideDir; } async function createPresentation() { console.log('🚀 Generating Birthday Class Meeting PowerPoint...\n'); // Create HTML files const slideDir = createHTMLFiles(); console.log('\n📄 HTML files created successfully\n'); const pptx = new pptxgen(); pptx.layout = 'LAYOUT_16x9'; pptx.author = 'Tingting - Class 7-3'; pptx.title = '七年三班生日主题班会'; try { // Process each slide for (let i = 0; i < slides.length; i++) { const slideFile = path.join(slideDir, `slide_${i + 1}.html`); console.log(`📊 Processing Slide ${i + 1}/${slides.length}...`); await html2pptx(slideFile, pptx); } // Save presentation await pptx.writeFile({ fileName: 'Birthday_ClassMeeting_Class73.pptx' }); console.log('\n✅ PowerPoint generated successfully!'); console.log('📁 File: Birthday_ClassMeeting_Class73.pptx'); console.log('🎨 Style: Tingting Signature Elegant + Celebration'); console.log(`📊 Total slides: ${slides.length}`); console.log('\n✏️ Corrections applied:'); console.log(' • Slide 7: Fixed surprise moment text'); console.log(' • Slide 9: Optimized content (removed repetition)'); console.log(' • Slide 15: Fixed typo 住→祝'); console.log('\n➕ New slides added:'); console.log(' • Slide 13: Interactive classmate blessings'); console.log(' • Slide 14: Gratitude to parents'); console.log(' • Slide 16: Class photo moment'); console.log(' • Slide 17: Looking forward'); console.log('\n💡 All elements are 100% editable in PowerPoint!'); } catch (error) { console.error('\n❌ Error:', error.message); if (error.stack) { console.error('\nStack:', error.stack); } } } createPresentation();