blog-chart
agricidaniel/claude-blog
Generate dark-mode-compatible SVG charts for blog posts with automatic platform detection.
What is blog-chart?
Creates accessible inline SVG data visualizations (bar, donut, line, lollipop, area, radar) for blog content. Automatically detects HTML vs JSX/MDX output format and enforces WCAG compliance with proper ARIA labels, source attribution, and colorblind-friendly styling.
- Generates 7 chart types: horizontal bar, grouped bar, donut, line, lollipop, area, and radar charts
- Automatically detects platform (HTML vs JSX/MDX) and outputs correct syntax
- Ensures dark-mode and light-mode compatibility using currentColor and CSS variables
- Enforces accessibility with role=img, aria-labelledby, and full descriptions for screen readers
- Applies colorblind-friendly color palette with patterns and direct labels, not color alone
- Includes source attribution and proper chart dimensions with responsive scaling
How to install blog-chart
npx skills add https://github.com/agricidaniel/claude-blog --skill blog-chart- Python 3 installed for the deterministic CLI script (optional; skill can be invoked programmatically)
- Chart data in JSON format with type, title, values, and source attribution
How to use blog-chart
- 1.Provide a chart request with type (horizontal bar, grouped bar, donut, line, lollipop, area, or radar), title, data values, and source attribution
- 2.Specify platform: 'html' for HTML output or 'mdx' for JSX/MDX syntax
- 3.Call the skill with the chart request; it auto-detects the best chart type if not specified
- 4.Review the generated SVG for proper styling, accessibility attributes, and source citation
- 5.Embed the SVG in your blog post within a <figure> element
Use cases
- Visualizing quarterly product signups or performance metrics in blog posts
- Comparing before/after data or A vs B scenarios with grouped bar charts
- Displaying market share or parts-of-whole data with donut charts
- Showing trends over time in product adoption or metrics with line charts
- Ranking factors or correlations with lollipop charts for blog analysis pieces
- Technical writers and bloggers creating data-driven content
- Product managers documenting metrics and performance in blog posts
- Data journalists and analysts publishing findings on company blogs
- Content teams needing accessible, on-brand visualizations without external tools
blog-chart FAQ
It's invoked internally by blog-write and blog-rewrite when chart-worthy data is detected, but can also be called directly via the Python CLI script (generate_chart_svg.py) with a JSON input file.
All text uses fill='currentColor' and grid/axis lines use opacity values so they adapt to the host page's text color. The --chart-muted CSS variable controls muted text; it defaults to #4b5563 (light) or #d1d5db (dark) if not set.
The skill supports 7 core types (bar, grouped bar, donut, line, lollipop, area, radar). For other visualizations, provide the data and context; the skill will recommend the closest matching type or suggest a combination.
Yes. Every chart includes a <title> and <desc> with full data points and source, role='img', and aria-labelledby attributes. Labels and patterns ensure colorblind readers can distinguish series.
The skill enforces a fixed accessible color palette (orange, sky blue, purple, green) and styling rules for dark/light compatibility. Custom colors are not supported to maintain accessibility and brand consistency.
Full instructions (SKILL.md)
Source of truth, from agricidaniel/claude-blog.
name: blog-chart description: > Generate dark-mode-compatible inline SVG data visualization charts for blog posts. Supports horizontal bar, grouped bar, donut, line, lollipop, area, and radar charts with automatic platform detection (HTML vs JSX/MDX). Enforces chart type diversity, accessible markup (role=img, aria-labelledby), source attribution, and transparent backgrounds. Use when user says "blog chart", "generate chart", "data visualization", "svg chart", "blog graph", or "visualize data". user-invokable: false license: MIT
Blog Chart: Built-In SVG Data Visualization
Generates dark-mode-compatible inline SVG charts for blog posts. Invoked
internally by blog-write and blog-rewrite when chart-worthy data is
identified. Not a standalone user-facing command.
Styling source of truth: skills/blog/references/visual-media.md
For supported chart types, prefer the deterministic CLI:
python3 skills/blog-chart/scripts/generate_chart_svg.py --input chart.json --output chart.html --json
Input Format
The writer or researcher passes a chart request:
Chart Request:
- Type: horizontal bar
- Title: "Quarterly Signups by Product"
- Data: Product A 420, Product B 315, Product C 180
- Source: [Verified source], [publication date]
- Platform: mdx (or html)
Chart Type Selection
Select based on the data pattern. Prefer chart type diversity, but repeat a type when comparability or reader comprehension clearly benefits.
| Data Pattern | Best Chart Type |
|---|---|
| Before/after comparison | Grouped bar chart |
| Ranked factors / correlations | Lollipop chart |
| Parts of whole / market share | Donut chart |
| Trend over time | Line chart |
| Percentage improvement | Horizontal bar chart |
| Distribution / range | Area chart |
| Multi-dimensional scoring | Radar chart |
Styling Rules (Non-Negotiable)
All charts must work on both dark and light backgrounds:
Text elements: fill="currentColor"
Grid lines: stroke="currentColor" opacity="0.08"
Axis lines: stroke="currentColor" opacity="0.3"
Background: transparent (no fill on root SVG)
Subtitle text: fill="var(--chart-muted, currentColor)"
Source text: fill="var(--chart-muted, currentColor)"
Label text: fill="currentColor" opacity="0.8"
Set --chart-muted to an accessible text token in the host theme. If no token
exists, use #4b5563 on light backgrounds and #d1d5db on dark backgrounds.
Do not rely on low-opacity source or subtitle text for visible attribution.
Color Palette
| Color | Hex | Use Case |
|---|---|---|
| Orange | #f97316 | Primary / highest value |
| Sky Blue | #38bdf8 | Secondary / comparison |
| Purple | #a78bfa | Tertiary / special category |
| Green | #22c55e | Quaternary / positive indicator |
For text inside approved colored elements: use fill="#111827" with
fontWeight="800". Only use white text after checking the contrast ratio is
at least 4.5:1 against that specific fill color.
Do not rely on color alone. Add direct labels, patterns, line dashes, marker shapes, or legend text so colorblind readers can distinguish series.
Standard SVG Shell (HTML)
<svg
viewBox="0 0 560 380"
style="max-width: 100%; height: auto; font-family: 'Inter', system-ui, sans-serif"
role="img"
aria-labelledby="chart-title chart-desc"
>
<title id="chart-title">Chart Title</title>
<desc id="chart-desc">Description for screen readers with all key data points and source</desc>
<!-- Chart content -->
<text x="280" y="372" text-anchor="middle" font-size="10" fill="var(--chart-muted, currentColor)">
Source: Source Name (Year)
</text>
</svg>
JSX/MDX Shell (camelCase attributes)
<svg
viewBox="0 0 560 380"
style={{maxWidth: '100%', height: 'auto', fontFamily: "'Inter', system-ui, sans-serif"}}
role="img"
aria-labelledby="chart-title chart-desc"
>
<title id="chart-title">Chart Title</title>
<desc id="chart-desc">Description for screen readers</desc>
{/* Chart content */}
<text x="280" y="372" textAnchor="middle" fontSize="10" fill="var(--chart-muted, currentColor)">
Source: Source Name (Year)
</text>
</svg>
JSX Attribute Conversion (Required for MDX)
| HTML | JSX |
|---|---|
stroke-width | strokeWidth |
stroke-dasharray | strokeDasharray |
stroke-linecap | strokeLinecap |
text-anchor | textAnchor |
font-size | fontSize |
font-weight | fontWeight |
font-family | fontFamily |
class | className |
style="..." | style={{...}} |
Chart Type Construction
Horizontal Bar Chart
Best for: percentage improvements, single-metric comparisons.
- Define chart area: x=80, y=40, width=440, height=280
- Calculate bar height:
chartHeight / dataCount - gap(gap=8) - Calculate bar width:
(value / maxValue) * chartWidth - Position bars:
y = chartY + index * (barHeight + gap) - Label on left (right-aligned at x=75): category name
- Value label at end of bar: percentage or number
- Source text at bottom center
Grouped Bar Chart
Best for: before/after, A vs B comparisons.
- Define groups along Y axis, bars within each group
- Use 2 colors (primary + secondary) for the two series
- Add legend at top: colored square + label for each series
- Gap between groups > gap within groups
Donut Chart
Best for: parts of whole, market share.
- Center: cx=280, cy=180, outer radius=140, inner radius=80
- Calculate arc segments using cumulative angles
- Each segment:
<path d="M... A... L... A... Z" fill="color" /> - Center text: total or key label
- Legend below chart with color squares + labels + values
Line Chart
Best for: trends over time.
- X axis: time periods, evenly spaced
- Y axis: value range with 4-5 grid lines
- Draw grid lines:
stroke="currentColor" opacity="0.08" - Plot data points:
<circle cx=... cy=... r="4" fill="color" /> - Connect with:
<polyline points="..." fill="none" stroke="color" strokeWidth="2" /> - Optional: area fill below line with
opacity="0.1"
Lollipop Chart
Best for: ranked factors, correlations.
- Horizontal orientation (like bar chart but with circles)
- Thin line from axis to data point:
stroke="currentColor" opacity="0.15" strokeWidth="1" - Circle at data point:
r="6"with fill color - Value label next to circle
- Categories on Y axis (left-aligned)
Area Chart
Best for: distribution, cumulative data.
- Same as line chart but with filled area below
- Area fill:
<path d="M... L... L... Z" fill="color" opacity="0.15" /> - Line on top:
stroke="color" strokeWidth="2" fill="none" - Grid lines behind the area
Radar Chart
Best for: multi-dimensional scoring (5-7 axes).
- Center: cx=280, cy=190
- Draw concentric polygons for grid (3-4 levels)
- Calculate axis endpoints at equal angles
- Plot data points on each axis proportional to value
- Connect data points with filled polygon:
fill="color" opacity="0.2" stroke="color" - Label each axis at the outer edge
Label Rules
- Wrap long labels at word boundaries into
<tspan>lines. - Truncate only when wrapping would collide with data marks, and keep the full
label in
<desc>or adjacent prose. - Use stable chart dimensions with a responsive
max-width: 100%; height: autostyle, or choose a justified wider viewBox for dense labels. - Check mobile widths so axis labels, legends, and value labels do not overlap.
Output Format
Wrap every chart in a <figure> element:
HTML:
<figure>
<svg viewBox="0 0 560 380" style="max-width: 100%; height: auto; font-family: 'Inter', system-ui, sans-serif" role="img" aria-labelledby="chart-title chart-desc">
<title id="chart-title">[Chart Title]</title>
<desc id="chart-desc">[Full description with data points for screen readers]</desc>
<!-- chart content -->
<text x="280" y="372" text-anchor="middle" font-size="10" fill="var(--chart-muted, currentColor)">
Source: [Source Name] ([Year])
</text>
</svg>
<figcaption>Source: <a href="[Source URL]">[Source Name]</a>, [publication date].</figcaption>
</figure>
MDX:
<figure className="chart-container" style={{margin: '2.5rem 0', textAlign: 'center', padding: '1.5rem', borderRadius: '12px'}}>
<svg viewBox="0 0 560 380" style={{maxWidth: '100%', height: 'auto', fontFamily: "'Inter', system-ui, sans-serif"}} role="img" aria-labelledby="chart-title chart-desc">
<title id="chart-title">[Chart Title]</title>
<desc id="chart-desc">[Full description]</desc>
{/* chart content with camelCase attributes */}
<text x="280" y="372" textAnchor="middle" fontSize="10" fill="var(--chart-muted, currentColor)">
Source: [Source Name] ([Year])
</text>
</svg>
<figcaption>Source: <a href="[Source URL]">[Source Name]</a>, [publication date].</figcaption>
</figure>
Quality Checklist (Verify Before Returning)
- No hardcoded text colors except contrast-checked labels inside colored elements
- No white/light backgrounds (transparent or none)
- Source attribution text present at bottom and semantic
<figcaption>present -
role="img"andaria-labelledbypresent on<svg> -
<title id>and<desc id>present inside<svg> - Chart type choice supports comprehension and comparability
- If MDX: all attributes camelCased (no hyphens in attribute names)
- Data values match the source data exactly
- Color palette uses only approved colors
- ViewBox is
0 0 560 380(standard) or justified alternative - Labels, shapes, patterns, or line styles provide redundancy beyond color
Related skills
More from agricidaniel/claude-blog and the wider catalog.

blog-cluster
Plan and execute interlinked content ecosystems from a seed keyword using semantic clustering and hub-and-spoke architecture.

blog-discourse
Research what people are actually saying about a topic across Reddit, X, YouTube, HN, dev.to, and Medium in the last 30 days.

blog-factcheck
Verify statistics and claims in blog posts by checking cited sources against actual page content.

blog-flow
FLOW framework integration for evidence-led blog workflows: Find, Optimize, Win stages with 30 CC BY 4.0 prompts.

blog-geo
AI citation readiness audit for blog posts across ChatGPT, Perplexity, Claude, Gemini, and other AI search surfaces.

blog-google
Google API integration for blog performance: PageSpeed, Core Web Vitals, Search Console, GA4, and keyword research.