# HTML to PowerPoint Guide Convert HTML slides to PowerPoint presentations with accurate positioning using the `html2pptx.js` library. ## Table of Contents 1. [Design Principles](#design-principles) 2. [Creating HTML Slides](#creating-html-slides) 3. [Using the @ant/html2pptx Library](#using-the-html2pptx-library) 4. [Using PptxGenJS](#using-pptxgenjs) --- ## ⚠️ Prerequisites Check Verify the @ant/html2pptx package is installed before proceeding: ```bash # Check if installed and install if not found npm list -g @ant/html2pptx || npm install -g skills/pptx/html2pptx.tgz ``` This command will show the package version if installed, or install it automatically if not found. No additional verification is needed. --- ### Design Principles **CRITICAL**: Analyze the content and choose appropriate design elements before creating presentations: 1. **Consider the subject matter**: What is this presentation about? What tone, industry, or mood does it suggest? 2. **Check for branding**: If the user mentions a company/organization, consider their brand colors and identity 3. **Match palette to content**: Select colors that reflect the subject 4. **State your approach**: Explain your design choices before writing code **Requirements**: - ✅ State your content-informed design approach BEFORE writing code - ✅ Use web-safe fonts only: Arial, Helvetica, Times New Roman, Georgia, Courier New, Verdana, Tahoma, Trebuchet MS, Impact - ✅ Create clear visual hierarchy through size, weight, and color - ✅ Ensure readability: strong contrast, appropriately sized text, clean alignment - ✅ Be consistent: repeat patterns, spacing, and visual language across slides #### Typography and content design This is a presentation, not a report. Keep slides brief! - Paragraphs should be 1 sentence, _maybe_ 2. - You should restrict yourself to 3-5 bullet points per list. - Cards should support short statements/fragments. Maybe a complete sentence if it's short. We've found without instruction, agents tend to write 2-3x more text than optimal, so whatever you think is short, it's probably not short enough! For visual heirarchy reasons, you should generally not have more than 2 text sizes per slide, 3 or 4 for complex slides with a lot of components and charts. If you need additional distinction, consider using opacity. #### Color Palette Selection **Choosing colors creatively**: - **Think beyond defaults**: What colors genuinely match this specific topic? Avoid autopilot choices. - **Consider multiple angles**: Topic, industry, mood, energy level, target audience, brand identity (if mentioned) - **Be adventurous**: Try unexpected combinations - a healthcare presentation doesn't have to be green, finance doesn't have to be navy - **Build your palette**: Pick 3-5 colors that work together (dominant colors + supporting tones + accent) - **Ensure contrast**: Text must be clearly readable on backgrounds **Example color palettes** (use these to spark creativity - choose one, adapt it, or create your own): 1. **Classic Blue**: Deep navy (#1C2833), slate gray (#2E4053), silver (#AAB7B8), off-white (#F4F6F6) 2. **Teal & Coral**: Teal (#5EA8A7), deep teal (#277884), coral (#FE4447), white (#FFFFFF) 3. **Bold Red**: Red (#C0392B), bright red (#E74C3C), orange (#F39C12), yellow (#F1C40F), green (#2ECC71) 4. **Warm Blush**: Mauve (#A49393), blush (#EED6D3), rose (#E8B4B8), cream (#FAF7F2) 5. **Burgundy Luxury**: Burgundy (#5D1D2E), crimson (#951233), rust (#C15937), gold (#997929) 6. **Deep Purple & Emerald**: Purple (#B165FB), dark blue (#181B24), emerald (#40695B), white (#FFFFFF) 7. **Cream & Forest Green**: Cream (#FFE1C7), forest green (#40695B), white (#FCFCFC) 8. **Pink & Purple**: Pink (#F8275B), coral (#FF574A), rose (#FF737D), purple (#3D2F68) 9. **Lime & Plum**: Lime (#C5DE82), plum (#7C3A5F), coral (#FD8C6E), blue-gray (#98ACB5) 10. **Black & Gold**: Gold (#BF9A4A), black (#000000), cream (#F4F6F6) 11. **Sage & Terracotta**: Sage (#87A96B), terracotta (#E07A5F), cream (#F4F1DE), charcoal (#2C2C2C) 12. **Charcoal & Red**: Charcoal (#292929), red (#E33737), light gray (#CCCBCB) 13. **Vibrant Orange**: Orange (#F96D00), light gray (#F2F2F2), charcoal (#222831) 14. **Forest Green**: Black (#191A19), green (#4E9F3D), dark green (#1E5128), white (#FFFFFF) 15. **Retro Rainbow**: Purple (#722880), pink (#D72D51), orange (#EB5C18), amber (#F08800), gold (#DEB600) 16. **Vintage Earthy**: Mustard (#E3B448), sage (#CBD18F), forest green (#3A6B35), cream (#F4F1DE) 17. **Coastal Rose**: Old rose (#AD7670), beaver (#B49886), eggshell (#F3ECDC), ash gray (#BFD5BE) 18. **Orange & Turquoise**: Light orange (#FC993E), grayish turquoise (#667C6F), white (#FCFCFC) #### Maintaining visual interest Make use of icons, image placeholders, and charts to keep slides engaging. #### Visual Details Options **Geometric Patterns**: - Diagonal section dividers instead of horizontal - Asymmetric column widths (30/70, 40/60, 25/75) - Rotated text headers at 90° or 270° - Circular/hexagonal frames for images - Triangular accent shapes in corners - Overlapping shapes for depth **Border & Frame Treatments**: - Thick single-color borders (10-20px) on one side only - Double-line borders with contrasting colors - Corner brackets instead of full frames - L-shaped borders (top+left or bottom+right) - Underline accents beneath headers (4-6px thick) **Typography Treatments**: - Extreme size contrast (72px headlines vs 12px body) - All-caps headers with wide letter spacing - Numbered sections in oversized display type - Monospace (Courier New) for data/stats/technical content - Condensed fonts (Arial Narrow) for dense information - Outlined text for emphasis **Chart & Data Styling**: - Monochrome charts with single accent color for key data - Horizontal bar charts instead of vertical - Dot plots instead of bar charts - Minimal gridlines or none at all - Data labels directly on elements (no legends) - Oversized numbers for key metrics **Layout Innovations**: - Full-bleed images with text overlays - Sidebar column (20-30% width) for navigation/context - Modular grid systems (3×3, 4×4 blocks) - Z-pattern or F-pattern content flow - Floating text boxes over colored shapes - Magazine-style multi-column layouts **Background Treatments**: - Solid color blocks occupying 40-60% of slide - Gradient fills (vertical or diagonal only) - Split backgrounds (two colors, diagonal or vertical) - Edge-to-edge color bands - Negative space as a design element ### Layout Tips **To create slides with charts or tables:** - **Two-column layout (PREFERRED)**: Use a header spanning the full width, then two columns below - text/bullets in one column and the featured content in the other. This provides better balance and makes charts/tables more readable. Use unequal column widths (e.g., 40%/60% split) to optimize space for each content type. - **Full-slide layout**: Let the featured content (chart/table) take up the entire slide for maximum impact and readability - **NEVER vertically stack**: Do not place charts/tables below text in a single column - this causes poor readability and layout issues ## Creating HTML Slides Every HTML slide must include proper body dimensions: - **16:9** (automatically applied): `width: 960px; height: 540px` - **4:3**: `width: 960px; height: 720px` - **16:10**: `width: 960px; height: 600px` ### How to write CSS **MANDATORY - READ ENTIRE FILE**: Read [`css.md`](css.md) (~400 lines) completely from start to finish. **NEVER set any range limits when reading this file.** Read the full file content for detailed guidance on CSS structure before writing any HTML. Slides are automatically provided with a global stylesheet which is injected when the HTML is rendered. Guidelines for styles: - CRITICAL: REFRAIN FROM DEFINING YOUR OWN TYPE SIZES AND COLORS unless you are explicity "hitting the eject button." Use variables defined in the global stylesheet whenever possible. - Override these CSS variables (using the `:root` selector) to customize the look and feel of your slides - Use the classes from [`css.md`](css.md) when creating your slides. Reference the examples provided in that guide. ### Supported Elements #### Block Elements - `