Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
feat(skills): give each slide its own photo in the pptx skill
Ethanaed115e16fca
diff --git a/apps/teamhub/internal/skill/builtin_catalog_test.go b/apps/teamhub/internal/skill/builtin_catalog_test.goindex 59b40f73..1daf8352 100644--- a/apps/teamhub/internal/skill/builtin_catalog_test.go+++ b/apps/teamhub/internal/skill/builtin_catalog_test.go@@ -199,7 +199,7 @@ func assertImportedBuiltinSkillDefaults(t *testing.T, catalog builtinCatalog) {adapted := map[string]string{"simplexai_builtin_docx": "1.0.0","simplexai_builtin_pdf": "1.0.0",- "simplexai_builtin_pptx": "1.0.4",+ "simplexai_builtin_pptx": "1.0.5","simplexai_builtin_xlsx": "1.0.0","simplexai_builtin_skill_installer": "1.0.0",}diff --git a/apps/teamhub/tests/integration/app_helpers_test.go b/apps/teamhub/tests/integration/app_helpers_test.goindex 06507a57..c58cd6e2 100644--- a/apps/teamhub/tests/integration/app_helpers_test.go+++ b/apps/teamhub/tests/integration/app_helpers_test.go@@ -53,7 +53,7 @@ func agentSkillRegistrationsByID(bindings []agentSkillRegistrationResponse) map[}func hasOfficeDefaultSkillRegistrations(bindings map[string]agentSkillRegistrationResponse) bool {- for name, version := range map[string]string{"docx": "1.0.0", "pdf": "1.0.0", "pptx": "1.0.4", "xlsx": "1.0.0"} {+ for name, version := range map[string]string{"docx": "1.0.0", "pdf": "1.0.0", "pptx": "1.0.5", "xlsx": "1.0.0"} {binding := bindings["simplexai_builtin_"+name]if binding.Name != name || binding.ManifestVersion != version {return falsediff --git a/skills/builtin/catalog.yaml b/skills/builtin/catalog.yamlindex 55d4e3c8..559d844c 100644--- a/skills/builtin/catalog.yaml+++ b/skills/builtin/catalog.yaml@@ -181,7 +181,7 @@ skills:version: 1.0.0package_path: builtin/pdf/1.0.0- skill_id: simplexai_builtin_pptx- bootstrap_manifest_id: skill_manifest_simplexai_builtin_pptx_1_0_4+ bootstrap_manifest_id: skill_manifest_simplexai_builtin_pptx_1_0_5default_agent_types:- anotherme- general@@ -201,6 +201,9 @@ skills:- manifest_id: skill_manifest_simplexai_builtin_pptx_1_0_4version: 1.0.4package_path: builtin/pptx/1.0.4+ - manifest_id: skill_manifest_simplexai_builtin_pptx_1_0_5+ version: 1.0.5+ package_path: builtin/pptx/1.0.5- skill_id: simplexai_builtin_skill_installerbootstrap_manifest_id: skill_manifest_simplexai_builtin_skill_installer_1_0_0default_agent_types:diff --git a/skills/builtin/pptx/1.0.5/SKILL.md b/skills/builtin/pptx/1.0.5/SKILL.mdnew file mode 100644index 00000000..8f15a454--- /dev/null+++ b/skills/builtin/pptx/1.0.5/SKILL.md@@ -0,0 +1,240 @@+---+name: pptx+description: Create a new PowerPoint PPTX deck with PptxGenJS, to a professional visual standard. Use whenever a new slide deck is a deliverable. Covers the workflow from material and research to a per-slide brief, tested layouts and palettes, the design rules (images, charts, diagrams) and slide-by-slide render checks.+effort: high+---++# PowerPoint decks++A finished deck must look rich and professional: every slide carries a real+visual, not just a title and bullets. Read this whole file before building.++## Runtime++Install PptxGenJS into the current Context's `./agent` folder:++```bash+npm --prefix ./agent install pptxgenjs+```++This skill's folder holds `scripts/deck_template.js` (the starting script,+with the shared title bar, footer and card helpers), `scripts/check_deck.js`+(a content check), and in `references/` the tested slide layouts+(`layouts.md`), the palettes (`palettes.md`) and PptxGenJS usage+(`pptxgenjs.md`). Copy the template into `./playground/<scope>/` and run+scripts from the Context workspace:++```bash+NODE_PATH="$(pwd)/agent/node_modules" node ./playground/<scope>/deck.js ./playground/<scope>/<Deck>.pptx+```++Keep work under `./playground/<scope>/`.++## Workflow++The brief decides the content: topic, audience, slide order and facts. These+steps decide how you work, and every one of them runs whatever the brief says,+including a brief that only says to search the web or already lists the+slides. If a step cannot run, say why in the report.++1. **Read the requirement.** Keep the slide order and the meaning of each+ headline it gives; take numbers only from sources you can cite.+2. **Find the Human's existing material first (required for every new deck).**+ Before any web research, use your workspace tools (the documents and files+ available to you, and the Human's knowledge search; see the `teamhub-files`+ skill and your instructions) to check what the Human already has:+ - documents, spreadsheets, slides and PDFs about the same project, team,+ company or period, including any named in the brief;+ - facts recorded in their chats, meetings and documents, searched from+ several angles (results, causes, plans, asks, people);+ - **images, logos, brand files, team or office photos** of the company.+ Knowledge search covers text only, so look for these among the files.+ When the topic plainly lies outside anything the Human keeps (public news+ about someone else, a general explainer), one knowledge search is enough:+ record the query and that nothing relevant came back.+ Count content only if it is about the same project and period; the+ company's own logo, brand images and team or office photos count for any+ deck about that company. Read everything relevant, and write the inventory+ (found / used / not used and why, with IDs) to+ `./playground/<scope>/material.md`.+3. **Research the gaps** on the web, citing every source.+4. **Write the brief before coding**, in one go now that the material and+ research are in. First read [brief-template.md](brief-template.md) in this+ skill's folder; it is not repeated here. Then write+ `./playground/<scope>/brief.md` in that structure: copy what the+ requirement gives, fill every field it lacks yourself, marked as inferred,+ and give every slide its claim headline, its layout (one from+ `references/layouts.md`, or a custom one with the reason) and its exact+ visual (which image, chart or diagram). A photo is named by its URL or+ file, not just "photo"; plan one on the cover and on about every third or+ fourth slide. When the requirement does not give the audience, goal,+ setting or main message (a one-line request, say), infer them: pick the+ goal the deck serves and use its order (decide: situation → problem →+ options → recommendation → ask; understand: why it matters → how it works →+ example → limits → summary; persuade: pain → promise → how → proof → call+ to action; update: headline numbers → what went well → what didn't → risks+ → next steps). Unless the requirement says otherwise, the audience is the+ Human reading it on their own, in the language of the request. Report every+ field you inferred as an assumption.+5. **Collect images** (see Images) into `./playground/<scope>/img/`: download+ every image the brief names and record each source. Drop a planned photo+ only after you tried every source in the Images order (official sources,+ at least two free photo libraries, then neutral photos) and found nothing+ usable; list each search (query, site, result) in `brief.md`.+6. **Build** only once every slide in `brief.md` has its layout and visual and+ every image it names is in `img/`, with one script copied from+ `scripts/deck_template.js`. Set `THEME` once from `references/palettes.md`,+ build each slide from its layout in `references/layouts.md` with the+ template's helpers, and see `references/pptxgenjs.md` for images, charts+ and tables, so every slide looks the same.+7. **Render and inspect every slide** (see Check), fix, and render again.+8. **Report**: file path, the paths of `material.md` and `brief.md`, one line+ per slide, the Human's material found / used / not used and why, other+ sources used, every assumption, every missing fact, and any check you could+ not run.++## Design rules++### Story on the slide+- Every content slide's title is a **claim** (a sentence stating its point),+ not a label. Reading the titles in order tells the story.+- Keep each title to one line (about 60 Latin characters or 30 CJK+ characters at 28 pt); shorten the wording rather than wrapping.+- One point per slide. At most ~40 words of body text on a presented slide;+ put detail in speaker notes.+- Every fact has a short source line at the bottom of its slide.+- A claim about a person's private life, an allegation, an investigation or+ a legal dispute needs its primary source or two independent reputable+ outlets that you actually read; a page you could not open does not count.+ Never open a deck with such a claim on one source; if you keep it, say on+ the slide that one outlet reports it.++### Visual first+- **Every slide has one visual anchor**: a photo, a native chart, a diagram+ (flow, timeline, matrix, structure), KPI tiles or a big number. A slide that+ is only a title and bullets is a defect, except a short agenda.+- **Pick the visual from the content**: numbers that compare or change → chart;+ a sequence or mechanism → flow or timeline; options or trade-offs → cards or+ matrix; one striking figure → big number; people, products, places, mood →+ photo. A deck usually mixes all of these; there is no fixed ratio, but a deck+ without photos, without charts where there are numbers, or without a diagram+ where there is a process is not finished.+- **Vary the layouts**: never three slides in a row with the same layout. Use a+ full-bleed photo cover, section dividers for decks over ~8 slides, half-slide+ image beside text, cards and full-width charts.+- Speaker notes (`slide.addNotes(...)`) on every slide when the brief asks for+ them.++### Images+- **Every deck has real photos**: the cover, and image-beside-text, section and+ card slides wherever they fit; beyond the cover, about every third or fourth+ slide carries a photo.+- Find them in this order:+ 1. the Human's own images, logos and photos found in step 2 (use the+ company logo on the cover or footer when there is one);+ 2. official sources about the topic (company newsroom or press kit, product+ pages, official logos);+ 3. free photo libraries with a clear license (Unsplash, Pexels, Pixabay,+ Wikimedia Commons), searching for the topic;+ 4. if nothing on-topic fits, **neutral photos** from those libraries+ (architecture, city skyline, office or meeting scenes, landscapes,+ abstract textures) matching the deck's mood and colors.+ Never leave an empty image area, and never use a tiny or blurry image+ stretched up.+- **Each photo appears once in a deck**; only the company logo repeats, at+ logo size. When the sources run out, use a chart, diagram or cards instead.+- **Always credit the source**: a small caption on the image ("Image: <site> /+ <author or page>") and the full URL in that slide's speaker notes; list all+ credits on the sources slide or in the notes.+- Download the largest reasonable size (≥1600 px wide for full-bleed). Fill+ the frame with `sizing: { type: "cover" }`; never distort. Put text over a+ photo only on a translucent dark overlay (a rectangle whose fill has a+ `transparency` of about 50).++### Charts+- Native, editable charts only (`slide.addChart`), never chart screenshots;+ style them as in `references/pptxgenjs.md`.+- Highlight what the headline claims in the accent color and keep the rest+ neutral grey; label values on the bars and remove gridlines and needless+ legends.+- One message per chart; the title says what the chart proves; source below.++### Diagrams+- Draw them with native shapes and connectors: flows of 3–6 steps, timelines,+ 2×2 matrices only for two real dimensions, structure charts, cards, KPI+ tiles. Consistent corners, line weights and colors; highlight the step the+ slide is about.++### Look+- One style per deck: the one in the brief. Turn its name and description+ into exact colors, fonts and layout habits once at the top of the script,+ and use one accent color only for what the audience must notice. With no+ style given, pick the palette in `references/palettes.md` that fits the+ topic, never plain blue.++- 16:9 on the layouts' 10 × 5.625 in canvas, with their margins; nothing+ touches the edge except full-bleed photos and the layouts' own bands.+- Type: the sizes the layouts set (slide titles 20 pt, cover and closing+ titles 32–38 pt, body 10.5–14 pt, captions and sources 8–9 pt). Shorten+ text rather than shrinking it.+- **Size every text box to its content, for every viewer**: estimate the lines+ from characters per line at the chosen size, then make the box at least+ lines × font size × line height tall, plus its top and bottom insets, using+ 1.2 for Latin text and 1.5 for Chinese, Japanese or Korean. Viewers such as+ web previews keep the stored box size and scroll or clip what does not fit,+ so never rely on auto-fit (`fit: "shrink"` or `"resize"`) to make room. Size+ cards to their text instead of leaving large empty areas. Keep footers to+ one short line.+- Chinese text: set `THEME.font` to a CJK font such as PingFang SC or+ Microsoft YaHei; `fontFace` sets the East Asian typeface too.++## Check (every slide)++First run the content check, which lists every slide's text and flags empty+slides, leftover placeholder text and a photo used on more than one slide:++```bash+NODE_PATH="$(pwd)/agent/node_modules" node <skill folder>/scripts/check_deck.js <deck.pptx> --slides <n>+```++Then render to images:++```bash+soffice --headless --convert-to pdf --outdir <dir> <deck.pptx> # LibreOffice+pdftoppm -png -r 80 <dir>/<deck>.pdf <dir>/slide+```++If `soffice` is missing, try `micromamba install --yes --override-channels+--channel conda-forge --prefix ./agent/conda libreoffice` and run it with+`micromamba run --prefix ./agent/conda soffice ...`. If no renderer works, say+so in the report.++Check in two levels, so slide images do not fill your context:++1. **Overview**: tile the slide images into contact sheets (e.g. with+ ImageMagick `montage`, 4 per row, about 400 px wide each, up to 12 slides per sheet), open the+ sheets, and list the slides that look wrong or uncertain against the+ checklist below.+2. **Detail**: open the single-slide image only for those slides, fix them,+ re-render, and re-check only the slides you changed.++The checklist:++1. The title is a claim on one line; titles in order tell the story; order matches the brief.+2. The slide has a visual anchor; no three consecutive slides share a layout.+3. No text overflows its box, is cut off, overlaps, or touches the edge; footers stay on one line.+ LibreOffice grows auto-fit boxes, so a render can hide an overflow: also+ check in the script that every text box is at least as tall as the formula+ above.+4. No card, tile or text box is mostly empty; content fills its frame.+5. Images are sharp, not distorted, credited on the slide and in the notes.+6. Charts are native, labeled, and highlight what the title claims.+7. Text sizes are the ones the layouts set and stay within the word budget.+8. One style throughout: fonts, colors, title position, footer.+9. Every number has a source; nothing invented; gaps are marked visibly.+ Relevant material the Human already has is used, or the report says why+ not (off-topic, superseded).+10. Chinese text renders in a CJK font.+11. Speaker notes present when asked; the last slide states the ask or next step.++Fix every failure and render again before reporting.diff --git a/skills/builtin/pptx/1.0.5/brief-template.md b/skills/builtin/pptx/1.0.5/brief-template.mdnew file mode 100644index 00000000..997f0c3a--- /dev/null+++ b/skills/builtin/pptx/1.0.5/brief-template.md@@ -0,0 +1,38 @@+# Deck brief template++Write `./playground/<scope>/brief.md` in this structure. Copy every field the+requirement gives; fill each missing one yourself and mark it "(inferred)".+Refer to skills by name, never by a local file path.++```markdown+# Deck brief: <title>++## Audience and goal+- Audience: <who>+- Goal: <what they should think or do afterwards>+- Setting: <presented live | sent to read>, about <n> slides+- Language: <language of slide text>++## Main message+<one sentence>++## Look+- Style: <name, e.g. McKinsey blue, or the user's template> — background, text and accent colors (hex), fonts, layout habits+- Slide size: 16:9 unless stated++## Storyline+1. <claim headline> — <layout> — <the exact image, chart or diagram it shows, with its source>+2. ...++## Topic for finding material+- Entities: <project, product, team, client, period, and aliases>+- Mentioned by the Human: <documents, files, rooms, people they named>+- Avoid: <topics, numbers or sources the Human excluded or that are sensitive for this audience>++## Facts from the conversation+- <quote anything the Human said that the deck needs>++## Output+- File: ./playground/<task-id>/<FileName>.pptx+- Speaker notes: <yes | no>+```diff --git a/skills/builtin/pptx/1.0.5/references/NOTICE.md b/skills/builtin/pptx/1.0.5/references/NOTICE.mdnew file mode 100644index 00000000..1c8ba48d--- /dev/null+++ b/skills/builtin/pptx/1.0.5/references/NOTICE.md@@ -0,0 +1,25 @@+# Notice++The slide layouts, palettes, PptxGenJS notes and scripts in this skill are+adapted from pptx-deck (https://github.com/Atomic-man007/pptx-deck-plugin),+published under the MIT License:++> Copyright (c) dbaas-operation-agents contributors+>+> Permission is hereby granted, free of charge, to any person obtaining a copy+> of this software and associated documentation files (the "Software"), to deal+> in the Software without restriction, including without limitation the rights+> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+> copies of the Software, and to permit persons to whom the Software is+> furnished to do so, subject to the following conditions:+>+> The above copyright notice and this permission notice shall be included in+> all copies or substantial portions of the Software.+>+> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+> SOFTWARE.diff --git a/skills/builtin/pptx/1.0.5/references/layouts.md b/skills/builtin/pptx/1.0.5/references/layouts.mdnew file mode 100644index 00000000..c334449f--- /dev/null+++ b/skills/builtin/pptx/1.0.5/references/layouts.md@@ -0,0 +1,323 @@+# Slide layouts++Seven tested layouts on the 10 × 5.625 in canvas. Each block builds one slide+with `deck`, `THEME`, `FONT` and the helpers `titleBar`, `pageFooter`,+`accentCard` and `softShadow` from `scripts/deck_template.js`. Copy a block,+replace the sample text with the brief's content, and keep the positions and+sizes; shorten text rather than shrinking it.++| Layout | Use it for |+|---|---|+| `cover` | the first slide |+| `two-column` | a problem and its answer, before and after, a list beside a panel |+| `flow` | a process, a pipeline, steps in order |+| `cards` | four parallel points (2 × 2) |+| `metrics` | up to six numbers that matter |+| `phases` | three stages, a roadmap, next steps |+| `closing` | the last slide: what is done, what is open, the ask |++## cover++```javascript+{+ const slide = deck.addSlide();+ slide.background = { color: THEME.ink };++ // Two vertical stripes on the left edge+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 0, y: 0, w: 0.55, h: 5.625,+ fill: { color: THEME.main }, line: { color: THEME.main },+ });+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 0.55, y: 0, w: 0.12, h: 5.625,+ fill: { color: THEME.highlight }, line: { color: THEME.highlight },+ });++ slide.addText("Deck title", {+ x: 1.0, y: 1.3, w: 8.5, h: 0.75,+ fontSize: 38, fontFace: FONT, bold: true, color: THEME.paper, margin: 0,+ });+ slide.addText("One-line subtitle", {+ x: 1.0, y: 2.15, w: 8.5, h: 0.4,+ fontSize: 18, fontFace: FONT, color: THEME.main, margin: 0,+ });+ // Short rule under the subtitle+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 1.0, y: 2.7, w: 3.5, h: 0.05,+ fill: { color: THEME.highlight }, line: { color: THEME.highlight },+ });+ slide.addText("Presenter | Team | Date", {+ x: 1.0, y: 4.9, w: 8, h: 0.3,+ fontSize: 11, fontFace: FONT, color: "888888", margin: 0,+ });+}+```++## two-column++```javascript+{+ const slide = deck.addSlide();+ slide.background = { color: THEME.paper };+ titleBar(slide, "Claim headline", "Optional subheading");+ pageFooter(slide, "Deck title | Date", 2);++ // Left: a heading over a short bullet list+ slide.addText("Left heading", {+ x: 0.35, y: 1.05, w: 4.4, h: 0.35,+ fontSize: 14, fontFace: FONT, bold: true, color: THEME.ink, margin: 0,+ });+ slide.addText([+ { text: "First point", options: { bullet: true, breakLine: true } },+ { text: "Second point", options: { bullet: true, breakLine: true } },+ { text: "Third point", options: { bullet: true } },+ ], {+ x: 0.35, y: 1.45, w: 4.4, h: 2.5,+ fontSize: 11, fontFace: FONT, color: THEME.ink,+ });++ // Right: a tinted panel with a colored top edge+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 5.1, y: 1.05, w: 4.55, h: 3.9,+ fill: { color: THEME.canvas }, line: { color: "E0E0E0" },+ });+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 5.1, y: 1.05, w: 4.55, h: 0.06,+ fill: { color: THEME.main }, line: { color: THEME.main },+ });+ slide.addText("Right heading", {+ x: 5.25, y: 1.15, w: 4.2, h: 0.35,+ fontSize: 13, fontFace: FONT, bold: true, color: THEME.main, margin: 0,+ });+ slide.addText("Text for the right panel.", {+ x: 5.25, y: 1.6, w: 4.2, h: 3.2,+ fontSize: 10.5, fontFace: FONT, color: "555555", wrap: true, margin: 0,+ });+}+```++## flow++```javascript+{+ const slide = deck.addSlide();+ slide.background = { color: THEME.paper };+ titleBar(slide, "Claim headline", "How it works");+ pageFooter(slide, "Deck title | Date", 3);++ const steps = [+ { label: "Step 1\nInput", color: THEME.main },+ { label: "Step 2\nProcess", color: THEME.support },+ { label: "Step 3\nCheck", color: THEME.highlight },+ { label: "Step 4\nOutput", color: "2E7D32" },+ ];++ steps.forEach((step, i) => {+ const x = 0.5 + i * 2.3;+ slide.addShape(deck.shapes.RECTANGLE, {+ x, y: 1.8, w: 2.0, h: 0.9,+ fill: { color: THEME.canvas }, line: { color: step.color, width: 1.5 },+ shadow: softShadow(3, 1, 0.1),+ });+ slide.addText(step.label, {+ x, y: 1.8, w: 2.0, h: 0.9,+ fontSize: 11, fontFace: FONT, bold: true, color: step.color,+ align: "center", valign: "middle", margin: 0,+ });+ // Connector to the next step+ if (i < steps.length - 1) {+ slide.addShape(deck.shapes.RECTANGLE, {+ x: x + 2.0, y: 2.2, w: 0.28, h: 0.06,+ fill: { color: "888888" }, line: { color: "888888" },+ });+ slide.addText("▶", {+ x: x + 2.16, y: 2.12, w: 0.18, h: 0.22,+ fontSize: 9, fontFace: FONT, color: "888888", margin: 0,+ });+ }+ });+}+```++## cards++```javascript+{+ const slide = deck.addSlide();+ slide.background = { color: THEME.paper };+ titleBar(slide, "Claim headline", "Four points");+ pageFooter(slide, "Deck title | Date", 4);++ const cards = [+ { heading: "First point", text: "One or two lines on it.", color: THEME.main },+ { heading: "Second point", text: "One or two lines on it.", color: THEME.highlight },+ { heading: "Third point", text: "One or two lines on it.", color: "2E7D32" },+ { heading: "Fourth point", text: "One or two lines on it.", color: THEME.support },+ ];++ cards.forEach((card, i) => {+ const column = i % 2;+ const row = Math.floor(i / 2);+ accentCard(slide,+ 0.3 + column * 4.85, 1.1 + row * 1.9, 4.5, 1.7,+ card.heading, card.text, card.color);+ });+}+```++## metrics++```javascript+{+ const slide = deck.addSlide();+ slide.background = { color: THEME.paper };+ titleBar(slide, "Claim headline", "The numbers");+ pageFooter(slide, "Deck title | Date", 5);++ const metrics = [+ { value: "98%", label: "Uptime", note: "Last 30 days", color: "2E7D32" },+ { value: "1.2s", label: "Response time", note: "P99", color: THEME.main },+ { value: "400+", label: "Tests passing", note: "Automated", color: THEME.highlight },+ { value: "12", label: "Rules active", note: "Enforced", color: THEME.support },+ { value: "< 5m", label: "Deploy time", note: "Per service", color: "6A1B9A" },+ { value: "Zero", label: "Incidents", note: "This quarter", color: "E65100" },+ ];++ metrics.forEach((metric, i) => {+ const x = 0.3 + (i % 3) * 3.2;+ const y = 1.1 + Math.floor(i / 3) * 1.9;+ slide.addShape(deck.shapes.RECTANGLE, {+ x, y, w: 3.0, h: 1.6,+ fill: { color: THEME.paper }, line: { color: "E0E0E0" },+ shadow: softShadow(3, 1, 0.08),+ });+ // Colored top edge+ slide.addShape(deck.shapes.RECTANGLE, {+ x, y, w: 3.0, h: 0.07,+ fill: { color: metric.color }, line: { color: metric.color },+ });+ slide.addText(metric.value, {+ x: x + 0.15, y: y + 0.15, w: 2.7, h: 0.65,+ fontSize: 30, fontFace: FONT, bold: true, color: metric.color, margin: 0,+ });+ slide.addText(metric.label, {+ x: x + 0.15, y: y + 0.82, w: 2.7, h: 0.3,+ fontSize: 11.5, fontFace: FONT, bold: true, color: THEME.ink, margin: 0,+ });+ slide.addText(metric.note, {+ x: x + 0.15, y: y + 1.15, w: 2.7, h: 0.3,+ fontSize: 9, fontFace: FONT, color: "888888", margin: 0,+ });+ });+}+```++## phases++```javascript+{+ const slide = deck.addSlide();+ slide.background = { color: THEME.paper };+ titleBar(slide, "Claim headline", "Three stages");+ pageFooter(slide, "Deck title | Date", 6);++ const phases = [+ { label: "STAGE 1\nNow", color: THEME.main,+ items: ["First action", "Second action", "Third action"] },+ { label: "STAGE 2\nNext", color: THEME.highlight,+ items: ["First action", "Second action", "Third action"] },+ { label: "STAGE 3\nLater", color: THEME.support,+ items: ["First action", "Second action", "Third action"] },+ ];++ phases.forEach((phase, i) => {+ const x = 0.3 + i * 3.2;+ slide.addShape(deck.shapes.RECTANGLE, {+ x, y: 1.05, w: 3.0, h: 3.8,+ fill: { color: THEME.canvas }, line: { color: phase.color, width: 1 },+ shadow: softShadow(4, 2, 0.08),+ });+ slide.addShape(deck.shapes.RECTANGLE, {+ x, y: 1.05, w: 3.0, h: 0.65,+ fill: { color: phase.color }, line: { color: phase.color },+ });+ slide.addText(phase.label, {+ x: x + 0.12, y: 1.1, w: 2.76, h: 0.55,+ fontSize: 11, fontFace: FONT, bold: true, color: THEME.paper,+ align: "center", valign: "middle", margin: 0,+ });+ phase.items.forEach((item, j) => {+ slide.addShape(deck.shapes.RECTANGLE, {+ x: x + 0.15, y: 1.85 + j * 0.82, w: 0.07, h: 0.42,+ fill: { color: phase.color }, line: { color: phase.color },+ });+ slide.addText(item, {+ x: x + 0.32, y: 1.82 + j * 0.82, w: 2.5, h: 0.52,+ fontSize: 10.5, fontFace: FONT, color: THEME.ink, wrap: true, margin: 0,+ });+ });+ });+}+```++## closing++```javascript+{+ const slide = deck.addSlide();+ slide.background = { color: THEME.main };++ // Stripe on the right edge+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 9.5, y: 0, w: 0.5, h: 5.625,+ fill: { color: THEME.highlight }, line: { color: THEME.highlight },+ });++ slide.addText("Summary", {+ x: 0.5, y: 0.4, w: 8, h: 0.65,+ fontSize: 32, fontFace: FONT, bold: true, color: THEME.paper, margin: 0,+ });+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 0.5, y: 1.1, w: 5, h: 0.05,+ fill: { color: THEME.paper }, line: { color: THEME.paper },+ });++ const done = ["Done item 1", "Done item 2", "Done item 3"];+ const open = ["Open item 1", "Open item 2"];++ slide.addText("Done", {+ x: 0.5, y: 1.25, w: 4.2, h: 0.32,+ fontSize: 13, fontFace: FONT, bold: true, color: "FFCCCC", margin: 0,+ });+ done.forEach((item, i) => {+ slide.addText("✓ " + item, {+ x: 0.5, y: 1.62 + i * 0.42, w: 4.5, h: 0.34,+ fontSize: 11, fontFace: FONT, color: THEME.paper, margin: 0,+ });+ });++ slide.addText("Open", {+ x: 5.3, y: 1.25, w: 3.8, h: 0.32,+ fontSize: 13, fontFace: FONT, bold: true, color: "FFCCCC", margin: 0,+ });+ open.forEach((item, i) => {+ slide.addText("◎ " + item, {+ x: 5.3, y: 1.62 + i * 0.42, w: 4.0, h: 0.34,+ fontSize: 11, fontFace: FONT, color: "FFE0E0", margin: 0,+ });+ });++ slide.addShape(deck.shapes.RECTANGLE, {+ x: 0.5, y: 4.2, w: 8.8, h: 0.05,+ fill: { color: THEME.paper }, line: { color: THEME.paper },+ });+ slide.addText("The ask or the next step.", {+ x: 0.5, y: 4.35, w: 8.8, h: 0.32,+ fontSize: 12, fontFace: FONT, bold: true, color: THEME.paper, margin: 0,+ });+ slide.addText("Presenter | Team | Date", {+ x: 0.5, y: 5.0, w: 8.8, h: 0.25,+ fontSize: 9, fontFace: FONT, color: "FF9999", margin: 0,+ });+}+```diff --git a/skills/builtin/pptx/1.0.5/references/palettes.md b/skills/builtin/pptx/1.0.5/references/palettes.mdnew file mode 100644index 00000000..08921049--- /dev/null+++ b/skills/builtin/pptx/1.0.5/references/palettes.md@@ -0,0 +1,62 @@+# Palettes++`THEME` at the top of the deck script holds the deck's colors and font. Colors+are 6-digit hex without `#`.++```javascript+const THEME = {+ main: "0070C0", // title bars and the strongest accents+ support: "404040", // subheadings and second-level accents+ ink: "1A1A1A", // body text and dark backgrounds+ paper: "FFFFFF", // light backgrounds and text on dark+ canvas: "F5F5F5", // soft slide and card backgrounds+ highlight: "FF6B35", // the one color for what must stand out+ font: "Calibri",+};+```++## Choosing one++Use the brief's style when it names one or gives brand colors. Otherwise pick+the row whose purpose fits the deck; do not fall back to plain blue.++| Palette | main | support | highlight | ink | canvas | font | Fits |+|---|---|---|---|---|---|---|---|+| Corporate blue | `0070C0` | `003087` | `00B0F0` | `1A1A1A` | `F0F4F8` | Calibri | finance, enterprise |+| Executive dark | `1E2761` | `408EC6` | `7A2048` | `0A0A0A` | `F5F5F5` | Calibri | leadership, board |+| Tech green | `00897B` | `00695C` | `FF6F00` | `212121` | `F1F8F6` | Calibri | engineering, operations |+| Startup bold | `6C63FF` | `3D5AFE` | `FF6584` | `1A1A2E` | `F8F8FF` | Calibri | product, pitch |+| Minimal mono | `212121` | `616161` | `FF5252` | `000000` | `FAFAFA` | Calibri | design, consulting |+| Warm business | `B85042` | `E7E8D1` | `A7BEAE` | `2C2C2C` | `FDF6F0` | Georgia | retail, people, culture |+| Deep navy | `003153` | `005F73` | `EE9B00` | `001220` | `F0F4F8` | Calibri | healthcare, legal |+| Vivid orange | `E85D04` | `F48C06` | `023E8A` | `1A1A1A` | `FFF8F2` | Calibri | marketing, sales |++`paper` stays `FFFFFF` in every palette.++## Fonts++| Font | Feel | Notes |+|---|---|---|+| Calibri | clean, modern | the default; available almost everywhere |+| Arial | neutral, corporate | the universal fallback |+| Georgia | warm, editorial | suits people and culture topics |+| Trebuchet MS | friendly, rounded | suits product and startup topics |+| Cambria | formal serif | suits legal and finance topics |++A viewer without the chosen font falls back to another one, so check the+render. The font also sets the East Asian typeface: when the slides contain+Chinese, use a CJK font instead, such as "PingFang SC" or "Microsoft YaHei".++## Where each color goes++```javascript+// Title bar → THEME.main+// Title bar text → THEME.paper+// Slide background → THEME.paper (or THEME.canvas)+// Card edge → THEME.main (or THEME.highlight)+// Body text → THEME.ink+// Muted text and captions → "888888"+// Done, success → "2E7D32"+// Open, warning → THEME.highlight+// Dividers → "E0E0E0"+```diff --git a/skills/builtin/pptx/1.0.5/references/pptxgenjs.md b/skills/builtin/pptx/1.0.5/references/pptxgenjs.mdnew file mode 100644index 00000000..51bd7b85--- /dev/null+++ b/skills/builtin/pptx/1.0.5/references/pptxgenjs.md@@ -0,0 +1,234 @@+# PptxGenJS notes++## A deck in brief++```javascript+const PptxGenJS = require("pptxgenjs");++const deck = new PptxGenJS(); // one new instance per deck+deck.layout = "LAYOUT_16x9";+deck.author = "Author";+deck.title = "Deck title";++const slide = deck.addSlide();+slide.addText("Hello", { x: 0.5, y: 0.5, fontSize: 36, color: "363636" });++deck.writeFile({ fileName: "deck.pptx" });+```++Canvas sizes, in inches: `LAYOUT_16x9` 10 × 5.625 (the default and the one the+layouts use), `LAYOUT_16x10` 10 × 6.25, `LAYOUT_4x3` 10 × 7.5, `LAYOUT_WIDE`+13.3 × 7.5.++## Text++```javascript+slide.addText("Plain text", {+ x: 1, y: 1, w: 8, h: 2, fontSize: 24, fontFace: "Arial",+ color: "363636", bold: true, align: "center", valign: "middle",+});++// Letter spacing is charSpacing; letterSpacing is ignored.+slide.addText("SPACED", { x: 1, y: 1, w: 8, h: 1, charSpacing: 6 });++// Mixed formatting in one box+slide.addText([+ { text: "Bold ", options: { bold: true } },+ { text: "italic", options: { italic: true } },+], { x: 1, y: 3, w: 8, h: 1 });++// Several lines: breakLine on every run but the last+slide.addText([+ { text: "Line 1", options: { breakLine: true } },+ { text: "Line 2", options: { breakLine: true } },+ { text: "Line 3" },+], { x: 0.5, y: 0.5, w: 8, h: 2 });+```++A text box has inner padding by default. Set `margin: 0` when its text must+line up with a shape, line or image at the same x.++`fontFace` sets the Latin and the East Asian typeface together, so text in+Chinese needs a font that has Chinese glyphs (for example "PingFang SC" or+"Microsoft YaHei").++## Lists++```javascript+slide.addText([+ { text: "First", options: { bullet: true, breakLine: true } },+ { text: "Second", options: { bullet: true, breakLine: true } },+ { text: "Third", options: { bullet: true } },+], { x: 0.5, y: 0.5, w: 8, h: 3 });++// Indented and numbered items+{ text: "Sub-item", options: { bullet: true, indentLevel: 1 } }+{ text: "First", options: { bullet: { type: "number" }, breakLine: true } }+```++Use `bullet: true`, never a typed "•": the typed one shows a second bullet.++## Shapes++```javascript+slide.addShape(deck.shapes.RECTANGLE, {+ x: 0.5, y: 0.8, w: 1.5, h: 3.0,+ fill: { color: "FF0000" }, line: { color: "000000", width: 2 },+});+slide.addShape(deck.shapes.OVAL, { x: 4, y: 1, w: 2, h: 2, fill: { color: "0000FF" } });+slide.addShape(deck.shapes.LINE, {+ x: 1, y: 3, w: 5, h: 0, line: { color: "FF0000", width: 3, dashType: "dash" },+});++// Translucent fill (0 opaque, 100 invisible)+slide.addShape(deck.shapes.RECTANGLE, {+ x: 1, y: 1, w: 3, h: 2, fill: { color: "0088CC", transparency: 50 },+});++// Rounded corners need ROUNDED_RECTANGLE; rectRadius does nothing on RECTANGLE.+slide.addShape(deck.shapes.ROUNDED_RECTANGLE, {+ x: 1, y: 1, w: 3, h: 2, fill: { color: "FFFFFF" }, rectRadius: 0.1,+});++// Shadow+slide.addShape(deck.shapes.RECTANGLE, {+ x: 1, y: 1, w: 3, h: 2, fill: { color: "FFFFFF" },+ shadow: { type: "outer", color: "000000", blur: 6, offset: 2, angle: 135, opacity: 0.15 },+});+```++| Shadow option | Values | Note |+|---|---|---|+| `type` | `"outer"`, `"inner"` | |+| `color` | 6-digit hex | no `#`, no alpha digits |+| `blur` | 0–100 pt | |+| `offset` | 0–200 pt | never negative: a negative offset corrupts the file |+| `angle` | 0–359° | where the shadow falls: 135 bottom-right, 270 up |+| `opacity` | 0.0–1.0 | the only place for shadow transparency |++To shadow upward, for a bar along the bottom, use `angle: 270` with a positive+offset. Gradient fills are not supported; use a gradient image as the+background instead.++## Images++```javascript+slide.addImage({ path: "img/photo.jpg", x: 1, y: 1, w: 5, h: 3 }); // file+slide.addImage({ path: "https://example.com/photo.jpg", x: 1, y: 1, w: 5, h: 3 }); // URL+slide.addImage({ data: "image/png;base64,iVBOR...", x: 1, y: 1, w: 5, h: 3 }); // base64++slide.addImage({+ path: "img/photo.jpg", x: 1, y: 1, w: 5, h: 3,+ rotate: 45, rounding: true, transparency: 50,+ flipH: true, flipV: false,+ altText: "What the image shows",+ hyperlink: { url: "https://example.com" },+});+```++Fit an image to its frame without distorting it:++```javascript+{ sizing: { type: "contain", w: 4, h: 3 } } // fits inside, keeps the ratio+{ sizing: { type: "cover", w: 4, h: 3 } } // fills the frame, keeps the ratio, may crop+{ sizing: { type: "crop", x: 0.5, y: 0.5, w: 2, h: 2 } } // a chosen part+```++Or size it from its pixel ratio:++```javascript+const pixelWidth = 1978, pixelHeight = 923, height = 3.0;+const width = height * (pixelWidth / pixelHeight);+slide.addImage({ path: "img/photo.jpg", x: (10 - width) / 2, y: 1.2, w: width, h: height });+```++PNG, JPG and GIF work everywhere; SVG works in current PowerPoint.++## Backgrounds++```javascript+slide.background = { color: "F1F1F1" };+slide.background = { color: "FF3399", transparency: 50 };+slide.background = { path: "https://example.com/bg.jpg" };+slide.background = { data: "image/png;base64,iVBOR..." };+```++## Tables++```javascript+slide.addTable([+ ["Header 1", "Header 2"],+ ["Cell 1", "Cell 2"],+], {+ x: 1, y: 1, w: 8, h: 2,+ border: { pt: 1, color: "999999" }, fill: { color: "F1F1F1" },+});++// Styled header and merged cells+slide.addTable([+ [{ text: "Header", options: { fill: { color: "6699CC" }, color: "FFFFFF", bold: true } }, "Cell"],+ [{ text: "Merged", options: { colspan: 2 } }],+], { x: 1, y: 3.5, w: 8, colW: [4, 4] });+```++## Charts++```javascript+slide.addChart(deck.charts.BAR, [{+ name: "Sales", labels: ["Q1", "Q2", "Q3", "Q4"], values: [4500, 5500, 6200, 7100],+}], { x: 0.5, y: 0.6, w: 6, h: 3, barDir: "col", showTitle: true, title: "Quarterly sales" });++slide.addChart(deck.charts.LINE, [{+ name: "Temperature", labels: ["Jan", "Feb", "Mar"], values: [32, 35, 42],+}], { x: 0.5, y: 4, w: 6, h: 3, lineSize: 3, lineSmooth: true });++slide.addChart(deck.charts.PIE, [{+ name: "Share", labels: ["A", "B", "Other"], values: [35, 45, 20],+}], { x: 7, y: 1, w: 5, h: 4, showPercent: true });+```++The defaults look dated. A clean chart:++```javascript+slide.addChart(deck.charts.BAR, data, {+ x: 0.5, y: 1, w: 9, h: 4, barDir: "col",+ chartColors: ["0D9488", "14B8A6", "5EEAD4"], // from the deck's palette+ chartArea: { fill: { color: "FFFFFF" }, roundedCorners: true },+ catAxisLabelColor: "64748B", valAxisLabelColor: "64748B", // quiet axis labels+ valGridLine: { color: "E2E8F0", size: 0.5 }, // light value grid only+ catGridLine: { style: "none" },+ showValue: true, dataLabelPosition: "outEnd", dataLabelColor: "1E293B",+ showLegend: false, // one series needs no legend+});+```++Other useful options: `legendPos` (`"b"`, `"t"`, `"l"`, `"r"`, `"tr"`),+`lineSmooth` for line charts. Chart types: BAR, LINE, PIE, DOUGHNUT, SCATTER,+BUBBLE, RADAR. Data label positions: `"outEnd"`, `"inEnd"`, `"center"`.++## Slide masters++```javascript+deck.defineSlideMaster({+ title: "TITLE_SLIDE",+ background: { color: "283A5E" },+ objects: [{ placeholder: { options: { name: "title", type: "title", x: 1, y: 2, w: 8, h: 2 } } }],+});++const titleSlide = deck.addSlide({ masterName: "TITLE_SLIDE" });+titleSlide.addText("Title", { placeholder: "title" });+```++## What breaks a deck++1. A `#` in a color (`"#FF0000"`) corrupts the file; write `"FF0000"`.+2. Alpha digits in a color (`"00000020"`) corrupt the file; set `opacity` (or+ `transparency`) instead.+3. A typed bullet character doubles the bullet; use `bullet: true`.+4. Runs without `breakLine: true` run together on one line.+5. `lineSpacing` on bullets leaves large gaps; use `paraSpaceAfter`.+6. Reusing a deck instance mixes decks; create a new one each time.+7. Reusing an options object corrupts the second shape: PptxGenJS converts its+ values in place. Build a new object for every call, as `softShadow()` does.+8. A straight accent strip cannot cover rounded corners; put accent strips on+ `RECTANGLE` cards, not `ROUNDED_RECTANGLE`.diff --git a/skills/builtin/pptx/1.0.5/scripts/check_deck.js b/skills/builtin/pptx/1.0.5/scripts/check_deck.jsnew file mode 100644index 00000000..6c72d3bd--- /dev/null+++ b/skills/builtin/pptx/1.0.5/scripts/check_deck.js@@ -0,0 +1,110 @@+// Content check for a built deck: lists each slide's text and fails when a+// slide has no text, still holds placeholder text, a photo appears on more+// than one slide, or the slide count differs from the expected one.+// NODE_PATH="$(pwd)/agent/node_modules" node check_deck.js <deck.pptx> [--slides N]+// Uses JSZip, which comes with pptxgenjs.++const crypto = require("node:crypto");+const fs = require("node:fs");+const path = require("node:path");+const JSZip = require("jszip");++const PLACEHOLDER = /\b(TODO|XXX|TBD|PLACEHOLDER|lorem|ipsum)\b|\[insert/i;+// A picture smaller than this share of the slide is a logo or an icon, which+// may repeat; a larger one is a photo, which may not.+const PHOTO_SHARE = 0.05;++function relationTargets(xml) {+ return new Map(+ [...xml.matchAll(/Id="(rId\d+)"[^>]*Target="([^"]+)"/g)].map((m) => [m[1], m[2]]),+ );+}++async function readDeck(deckPath) {+ const zip = await JSZip.loadAsync(fs.readFileSync(deckPath));+ const presentation = await zip.file("ppt/presentation.xml").async("string");+ const relations = relationTargets(+ await zip.file("ppt/_rels/presentation.xml.rels").async("string"),+ );+ const size = presentation.match(/<p:sldSz [^>]*cx="(\d+)"[^>]*cy="(\d+)"/);+ const slideArea = size ? Number(size[1]) * Number(size[2]) : 0;+ const slides = [];+ // Slides in presentation order, skipping masters and layouts.+ for (const [, id] of presentation.matchAll(/<p:sldId [^>]*r:id="(rId\d+)"/g)) {+ const target = relations.get(id);+ const name = target && `ppt/${target.replace(/^\/?ppt\//, "")}`;+ const file = name && zip.file(name);+ if (!file) continue;+ const xml = await file.async("string");+ const runs = [...xml.matchAll(/<a:t>([^<]*)<\/a:t>/g)].map((m) => m[1].trim()).filter(Boolean);+ const relsFile = zip.file(`${path.posix.dirname(name)}/_rels/${path.posix.basename(name)}.rels`);+ const slideRelations = relsFile ? relationTargets(await relsFile.async("string")) : new Map();+ const photos = [];+ // A background picture fills the slide; a picture shape covers its extent.+ const pictures = [+ ...[...xml.matchAll(/<p:bg>[\s\S]*?r:embed="(rId\d+)"[\s\S]*?<\/p:bg>/g)].map((m) => [m[1], 1]),+ ...[...xml.matchAll(/<p:pic>([\s\S]*?)<\/p:pic>/g)].map((m) => {+ const embed = m[1].match(/r:embed="(rId\d+)"/);+ const ext = m[1].match(/<a:ext cx="(\d+)" cy="(\d+)"/);+ const share = ext && slideArea ? (Number(ext[1]) * Number(ext[2])) / slideArea : 1;+ return [embed && embed[1], share];+ }),+ ];+ for (const [embed, share] of pictures) {+ const media = embed && slideRelations.get(embed);+ if (!media || share < PHOTO_SHARE) continue;+ const mediaFile = zip.file(path.posix.normalize(path.posix.join(path.posix.dirname(name), media)));+ if (!mediaFile) continue;+ const hash = crypto.createHash("sha256").update(await mediaFile.async("nodebuffer")).digest("hex");+ photos.push({ hash, media: path.posix.basename(media) });+ }+ slides.push({ text: runs.join(" "), photos });+ }+ return slides;+}++async function main() {+ const [deckPath, flag, count] = process.argv.slice(2);+ if (!deckPath) {+ console.error("usage: node check_deck.js <deck.pptx> [--slides N]");+ process.exit(2);+ }+ const expected = flag === "--slides" ? Number(count) : undefined;+ const slides = await readDeck(deckPath);+ const problems = [];+ slides.forEach(({ text }, i) => {+ if (!text) problems.push(`slide ${i + 1}: no text`);+ const match = text.match(PLACEHOLDER);+ if (match) problems.push(`slide ${i + 1}: placeholder text "${match[0]}"`);+ });+ const photoSlides = new Map();+ slides.forEach(({ photos }, i) => {+ for (const { hash, media } of photos) {+ const seen = photoSlides.get(hash) ?? { media, slides: new Set() };+ seen.slides.add(i + 1);+ photoSlides.set(hash, seen);+ }+ });+ for (const { media, slides: used } of photoSlides.values()) {+ if (used.size > 1) {+ problems.push(`photo ${media} repeats on slides ${[...used].join(", ")}: give each slide its own photo, chart or diagram`);+ }+ }+ if (expected !== undefined && slides.length !== expected) {+ problems.push(`slide count: expected ${expected}, found ${slides.length}`);+ }++ console.log(`${deckPath}: ${slides.length} slides`);+ slides.forEach(({ text }, i) => console.log(` ${String(i + 1).padStart(2)} ${text.slice(0, 70)}`));+ if (problems.length) {+ console.log(`\n${problems.length} problem(s):`);+ problems.forEach((problem) => console.log(` - ${problem}`));+ process.exit(1);+ }+ console.log("\nno problems found");+}++main().catch((error) => {+ console.error(error);+ process.exit(1);+});diff --git a/skills/builtin/pptx/1.0.5/scripts/deck_template.js b/skills/builtin/pptx/1.0.5/scripts/deck_template.jsnew file mode 100644index 00000000..092e7000--- /dev/null+++ b/skills/builtin/pptx/1.0.5/scripts/deck_template.js@@ -0,0 +1,172 @@+// Starting point for a new deck. Copy it next to your outputs, set THEME from+// references/palettes.md, replace the sample slides with layouts from+// references/layouts.md, then run:+// NODE_PATH="$(pwd)/agent/node_modules" node <copy>.js <output>.pptx+// Requires pptxgenjs in ./agent (npm --prefix ./agent install pptxgenjs).++const PptxGenJS = require("pptxgenjs");++// Colors are 6-digit hex without "#". font must cover every script in the deck:+// for Chinese text use a CJK font such as "PingFang SC" or "Microsoft YaHei".+const THEME = {+ main: "0070C0", // title bars and the strongest accents+ support: "003087", // subheadings and second-level accents+ ink: "1A1A1A", // body text and dark backgrounds+ paper: "FFFFFF", // light backgrounds and text on dark+ canvas: "F5F5F5", // soft slide and card backgrounds+ highlight: "FF6B35", // the one color for what must stand out+ font: "Calibri",+};++const FONT = THEME.font;++const deck = new PptxGenJS();+deck.layout = "LAYOUT_16x9"; // 10 x 5.625 in+deck.author = "Author";+deck.title = "Deck title";++// A new object on every call: PptxGenJS rewrites option objects in place.+function softShadow(blur, offset, opacity) {+ return { type: "outer", color: "000000", blur, offset, angle: 135, opacity };+}++// Colored band across the top of a content slide, with its title.+function titleBar(slide, heading, subheading) {+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 0, y: 0, w: 10, h: 0.85,+ fill: { color: THEME.main }, line: { color: THEME.main },+ });+ slide.addText(heading, {+ x: 0.35, y: 0.08, w: 9.3, h: 0.48,+ fontSize: 20, fontFace: FONT, bold: true,+ color: THEME.paper, valign: "middle", margin: 0,+ });+ if (subheading) {+ slide.addText(subheading, {+ x: 0.35, y: 0.56, w: 9.3, h: 0.22,+ fontSize: 10, fontFace: FONT, color: "DDDDDD",+ valign: "middle", margin: 0,+ });+ }+}++// Thin band along the bottom with a label and the page number.+function pageFooter(slide, label, page) {+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 0, y: 5.38, w: 10, h: 0.25,+ fill: { color: THEME.canvas }, line: { color: "E0E0E0" },+ });+ slide.addText(label || "", {+ x: 0.2, y: 5.39, w: 8.5, h: 0.22,+ fontSize: 8, fontFace: FONT, color: "888888", valign: "middle", margin: 0,+ });+ if (page) {+ slide.addText(String(page), {+ x: 9.4, y: 5.39, w: 0.4, h: 0.22,+ fontSize: 8, fontFace: FONT, color: "888888",+ align: "right", valign: "middle", margin: 0,+ });+ }+}++// White card with a colored strip down its left edge.+function accentCard(slide, x, y, w, h, heading, text, color) {+ const strip = color || THEME.main;+ slide.addShape(deck.shapes.RECTANGLE, {+ x, y, w, h,+ fill: { color: THEME.paper }, line: { color: "E0E0E0", width: 0.5 },+ shadow: softShadow(4, 2, 0.08),+ });+ slide.addShape(deck.shapes.RECTANGLE, {+ x, y, w: 0.07, h,+ fill: { color: strip }, line: { color: strip },+ });+ if (heading) {+ slide.addText(heading, {+ x: x + 0.16, y: y + 0.1, w: w - 0.22, h: 0.28,+ fontSize: 11, fontFace: FONT, bold: true, color: THEME.ink, margin: 0,+ });+ }+ if (text) {+ slide.addText(text, {+ x: x + 0.16, y: y + (heading ? 0.42 : 0.1),+ w: w - 0.22, h: h - (heading ? 0.55 : 0.2),+ fontSize: 10, fontFace: FONT, color: "555555", wrap: true, margin: 0,+ });+ }+}++// ---- Sample slides: replace them with layouts from references/layouts.md.++// Cover+{+ const slide = deck.addSlide();+ slide.background = { color: THEME.ink };+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 0, y: 0, w: 0.55, h: 5.625,+ fill: { color: THEME.main }, line: { color: THEME.main },+ });+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 0.55, y: 0, w: 0.12, h: 5.625,+ fill: { color: THEME.highlight }, line: { color: THEME.highlight },+ });+ slide.addText("Deck title", {+ x: 1.0, y: 1.3, w: 8.5, h: 0.75,+ fontSize: 36, fontFace: FONT, bold: true, color: THEME.paper, margin: 0,+ });+ slide.addText("One-line subtitle", {+ x: 1.0, y: 2.15, w: 8.5, h: 0.4,+ fontSize: 18, fontFace: FONT, color: THEME.main, margin: 0,+ });+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 1.0, y: 2.7, w: 3.5, h: 0.05,+ fill: { color: THEME.highlight }, line: { color: THEME.highlight },+ });+ slide.addText("Author | Team | Date", {+ x: 1.0, y: 4.9, w: 8, h: 0.3,+ fontSize: 11, fontFace: FONT, color: "888888", margin: 0,+ });+}++// Four cards+{+ const slide = deck.addSlide();+ slide.background = { color: THEME.paper };+ titleBar(slide, "Claim headline for this slide", "Optional subheading");+ pageFooter(slide, "Deck title | Date", 2);+ accentCard(slide, 0.3, 1.1, 4.4, 1.6, "First point", "One or two lines on it.", THEME.main);+ accentCard(slide, 5.0, 1.1, 4.4, 1.6, "Second point", "One or two lines on it.", THEME.highlight);+ accentCard(slide, 0.3, 2.9, 4.4, 1.6, "Third point", "One or two lines on it.", THEME.support);+ accentCard(slide, 5.0, 2.9, 4.4, 1.6, "Fourth point", "One or two lines on it.", "2E7D32");+}++// Closing+{+ const slide = deck.addSlide();+ slide.background = { color: THEME.main };+ slide.addShape(deck.shapes.RECTANGLE, {+ x: 9.5, y: 0, w: 0.5, h: 5.625,+ fill: { color: THEME.highlight }, line: { color: THEME.highlight },+ });+ slide.addText("Closing line", {+ x: 0.5, y: 1.5, w: 8.5, h: 0.9,+ fontSize: 42, fontFace: FONT, bold: true, color: THEME.paper, margin: 0,+ });+ slide.addText("The one thing to remember, or the ask.", {+ x: 0.5, y: 2.7, w: 8.5, h: 0.5,+ fontSize: 16, fontFace: FONT, color: "DDDDDD", margin: 0,+ });+ slide.addText("Author | Team | Date", {+ x: 0.5, y: 5.0, w: 8.5, h: 0.3,+ fontSize: 10, fontFace: FONT, color: "AAAAAA", margin: 0,+ });+}++const output = process.argv[2] || "deck.pptx";+deck+ .writeFile({ fileName: output })+ .then(() => console.log(`wrote ${output}`))+ .catch((error) => {+ console.error(error);+ process.exit(1);+ });