Editorial diagram design for Claude Code, Codex, GitHub Copilot, Cursor, Factory Droid, Qoder, and Pi. 45 diagram types. Self-contained HTML + SVG. No shadows. No Mermaid slop.
fix(export): normalize rgba()/transparent for PowerPoint's SVG importer (#151)
Jenil Ghevariyab119771a7b57
diff --git a/skills/diagram-design/references/export.md b/skills/diagram-design/references/export.mdindex e5b2f6a..dec0162 100644--- a/skills/diagram-design/references/export.md+++ b/skills/diagram-design/references/export.md@@ -39,8 +39,24 @@ If the user explicitly asks for "a screenshot of the whole page including the ca</defs>```If the SVG already contains a `<defs>` block, **merge** the `<style>` into it (don't add a second `<defs>`).-4. Prepend `<?xml version="1.0" encoding="UTF-8"?>\n` so the file is well-formed XML.-5. Write to `<basename>.svg` next to the source (e.g. `example-architecture.html` → `example-architecture.svg`). Honour an explicit output path if the user provides one.+4. Normalize colors for strict SVG 1.1 consumers. This design system's tokens are authored as `rgba(...)` (see `style-guide.md`) and render correctly wherever colors are read as CSS — browsers, Figma, Illustrator. PowerPoint's SVG importer does not: it treats `rgba(...)` and `transparent` as unrecognized and paints them **opaque black**, turning a barely-there tint into a solid block that swallows the label inside it. The transform is lossless (every replacement renders identically to the original in a browser), so apply it to the SVG string extracted in step 2, before writing the file:++ ```python+ import re++ svg = re.sub(+ r'(fill|stroke)="rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d*\.?\d+)\s*\)"',+ lambda m: '{0}="#{1:02x}{2:02x}{3:02x}" {0}-opacity="{4}"'.format(+ m.group(1), int(m.group(2)), int(m.group(3)), int(m.group(4)), m.group(5)+ ),+ svg,+ )+ svg = re.sub(r'(fill|stroke)="transparent"', r'\1="none"', svg)+ ```++ The `\s*` around each channel tolerates a spaced `rgba(45, 49, 66, 0.03)` as well as the compact `rgba(45,49,66,0.03)` the templates normally use; `\d*\.?\d+` accepts an alpha value with or without a leading zero (both `0.03` and `.03` appear in shipped tokens). Matching is scoped to the `fill="..."` / `stroke="..."` presentation attribute, not the bare `rgba(` string, so nothing else is touched — the shipped templates and examples only ever express color through these two attributes on SVG elements, never a `style="..."` attribute or a `<style>` block. (A brand's onboarded palette in `style-guide.md` could in principle add a third notation such as `hsl()`; none exists in any shipped token today, so this pass doesn't handle it — extend the regex if one is ever introduced.)+5. Prepend `<?xml version="1.0" encoding="UTF-8"?>\n` so the file is well-formed XML.+6. Write to `<basename>.svg` next to the source (e.g. `example-architecture.html` → `example-architecture.svg`). Honour an explicit output path if the user provides one.### Caveat to surface to the user