AgentSkillsCN

generating-infographics

当需要制作信息图、数据可视化、流程图、时间轴或对比图时使用——借助 @antv/infographic,利用 7 大类共 114 种模板,生成品牌化信息图。可通过“制作信息图”、“制作信息图”、“数据可视化”、“时间轴”、“流程图”等短语触发。

SKILL.md
--- frontmatter
name: generating-infographics
description: Use when creating infographics, data visualizations, process diagrams, timelines, or comparisons - generates branded infographics using @antv/infographic with 114 templates across 7 categories. Triggers on "create infographic", "make infographic", "visualize data", "timeline", "process diagram".
version: 1.11.3
model: sonnet
user-invocable: false

Generating Infographics

Generate branded infographics with custom themes and backgrounds using @antv/infographic.

Prerequisites

  1. Run /brand-init to create project structure
  2. Run /brand-extract to generate brand-philosophy.md
  3. Run /template-infographic to create an infographic template

When to Use

  • "Create an infographic"
  • "Make a process diagram"
  • "Visualize this data"
  • "Create a timeline"
  • "Show comparison infographic"
  • NOT for: Charts/graphs (use charting library), presentations (use visual-content skill)

Commands

CommandPurpose
/template-infographicCreate infographic template
/infographicGenerate infographic (guided)
/infographic-quickGenerate infographic (fast)

Template Categories (114 Total)

CategoryCountUse CasesIconsIllustrated
Sequence43Timelines, steps, processes, roadmaps✓ (2)✓ (5)
List23Features, grids, pyramids, sectors✓ (4)✓ (1)
Hierarchy25Org charts, tree structures
Compare17VS, before/after, SWOT
Quadrant32x2 matrices✓ (1)
Relation2Networks, connections✓ (1)
Chart1Bar charts

Template Asset Types

TypeCountIdentifierData Format
Text-only100+(default){ "label": "Cloud", "desc": "Infrastructure" }
Icon-based8icon in name{ "label": "icon:rocket", "desc": "Fast" }
Illustrated9-illus suffix{ "label": "Step 1", "desc": "Discovery", "illus": "step-1" }

Recommendation: Start with text-only templates. Illustrated templates require custom image files.

Illustrated Template Workflow

When using -illus templates:

  1. Content includes illus field referencing image filename
  2. Supported formats: SVG (recommended), PNG, JPG
  3. Options: provide your own images, find icons, or use placeholders
  4. Images stored with infographic output: infographics/{date}-{name}/illustrations/
  5. See references/illustrations.md for detailed workflow

Text Guidelines (Avoiding Overlap)

ElementMaxGoodBad
Labels1-2 words"Cloud""Cloud Computing Services"
Descriptions2-4 words"Infrastructure design""Complete infrastructure design and implementation"

If overlap occurs: shorten text, use wider canvas (1200px+), or use column/grid templates.

Quick Reference

TaskHow
Generate infographicnode generate.js --config config.json --data '{...}' --output output.png
Set background--background "spotlight-dots"
SVG output--format svg

Background Presets

Layered (gradient + pattern):

PresetEffect
spotlight-dotsRadial spotlight + subtle dots (recommended)
spotlight-gridRadial spotlight + grid lines
diagonal-crosshatchDiagonal fade + crosshatch
tech-matrixTech gradient + dense grid

Simple (gradient or pattern only):

PresetEffect
spotlightRadial gradient only
diagonal-fadeCorner to corner fade
top-downVertical fade
subtle-dotsLight dot pattern
tech-gridGrid lines
crosshatchDiagonal crosshatch
solidPlain solid color

Workflow

1. Create Template (once)

code
/template-infographic

Select: category → design → palette → background → style

2. Generate Infographic (repeat)

code
/infographic-quick

Select template → paste content → name → get PNG

Accessibility & Readability (MANDATORY)

These checks are NON-NEGOTIABLE before generating any infographic.

Contrast Validation (WCAG AA)

RequirementValue
Minimum contrast ratio4.5:1 for all text
Large text (title)3:1 acceptable
StandardWCAG 2.1 AA

Key principle: Palette colors are for SHAPES and FILLS, not text. Text needs explicit high-contrast colors.

Text Color Rules by Background

Background TypeTitle FillDescription FillLabel Fill
Dark (spotlight-dots, tech-matrix)#FFFFFFrgba(255,255,255,0.85)#FFFFFF
Light (solid, subtle-dots)#1A202C#4A5568#1A202C

Never use palette colors for text - they're for decorative shapes only.

Spacing & Balance Rules

ElementRequirement
Item spacingMinimum 20px between items
Edge marginsNever touch canvas edges (min 5% padding)
Text truncationLabels 1-2 words, descriptions 2-4 words
Visual balanceEqual spacing between similar elements

Pre-Generation Checklist

code
□ All text has 4.5:1 contrast against background
□ Labels are 1-2 words (no overlap risk)
□ Descriptions are 2-4 words
□ Content fits template capacity (check item limits)
□ Dark bg → white text, Light bg → dark text
□ No text touching edges

If ANY check fails, DO NOT generate. Fix the content or config first.

Config Examples

Dark Backgrounds (spotlight-dots, tech-matrix, etc.)

json
{
  "colorBg": "#0D2B5C",
  "colorPrimary": "#60A5FA",
  "title": { "fill": "#FFFFFF" },
  "desc": { "fill": "rgba(255,255,255,0.85)" },
  "item": {
    "label": { "fill": "#FFFFFF" },
    "desc": { "fill": "rgba(255,255,255,0.7)" }
  }
}

Light Backgrounds (solid, subtle-dots, etc.)

json
{
  "colorBg": "#FFFFFF",
  "colorPrimary": "#3B82F6",
  "title": { "fill": "#1A202C" },
  "desc": { "fill": "#4A5568" },
  "item": {
    "label": { "fill": "#1A202C" },
    "desc": { "fill": "#4A5568" }
  }
}

Common mistake: Using pastel palette colors for text on light backgrounds. Pastels are for decorative shapes only.

See template-infographic.md for complete config examples.

Data Structure by Type

Sequence/List

json
{
  "title": "Our Process",
  "items": [
    { "label": "Step 1", "desc": "Discovery" },
    { "label": "Step 2", "desc": "Design" }
  ]
}

Compare

json
{
  "title": "Before vs After",
  "items": [
    { "label": "Before", "children": [{ "label": "Slow" }] },
    { "label": "After", "children": [{ "label": "Fast" }] }
  ]
}

Hierarchy

json
{
  "title": "Organization",
  "items": [{
    "label": "CEO",
    "children": [{ "label": "CTO" }, { "label": "CFO" }]
  }]
}

Common Mistakes

MistakeFix
Text overlappingShorten labels (1-2 words), descriptions (2-4 words)
Missing illustrationsCheck template ends in -illus, provide SVG/PNG/JPG files
Icon not showingUse icon:name syntax, only for icon templates
Background not appliedPass --background flag to generate.js
Text invisible on light bgAdd explicit title/desc/item fills with dark colors (#1A202C, #4A5568)
Pastel text unreadablePalette colors are for shapes only; text needs high contrast (~4.5:1)

References

  • references/templates.md - Complete 114 template catalog with asset requirements
  • references/theming.md - Theme configuration details
  • references/backgrounds.md - Background customization guide
  • references/icons.md - Available icons for icon-based templates
  • references/illustrations.md - Illustrated template workflow and SVG requirements

Module Structure

code
lib/
├── renderer.js       # Main entry point
├── dom-setup.js      # JSDOM environment
├── infographic.js    # Infographic creation
├── exporter.js       # SVG/PNG export
├── backgrounds.js    # Gradient/pattern backgrounds
└── icons.js          # Icon utilities