算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
blog-figure-svg【设计与创意】Design accessible, source-backed SVG editorial figures and optionally rasterize reviewed assets for a blog or CMS. Use when a post needs a flow, comparison, taxonomy, terminal mock, or feature card. Trigger with "add a figure to this post" or "make an SVG diagram".
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Create lightweight editorial artwork whose visual claims are traceable to the approved article or source data. Supported shapes are process flows, comparison bars, taxonomies, terminal mocks, and 1600x840 feature cards.
The editable SVG is the source of truth. PNG rasterization is optional, and CMS upload remains a separate approved action.
tmp/blog-drafts/rsvg-convert, Inkscape, or CairoSVGpngquant or oxipng for lossless or reviewed lossy compressionUse Read to inspect the approved article and brand tokens. Use Write or Edit for local SVG, caption, and receipt files. The scoped Bash commands may only detect or invoke the named local renderers and Python validator; never interpolate untrusted titles, SVG fragments, filenames, or shell arguments.
flow for ordered steps, compare for sourced numeric values, taxonomy for categories, terminal for verified command output, or feature for a title card.viewBox. Use text elements rather than embedded fonts, preserve readable contrast, and keep labels legible at the target display width.<title> and <desc>, then connect them with role="img" and aria-labelledby. Decorative shapes should not add noise to the accessibility tree.foreignObject, or unreviewed embedded data.Every figure starts with this security and accessibility shape:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 900"
role="img" aria-labelledby="figure-title figure-desc">
<title id="figure-title">Approved figure title</title>
<desc id="figure-desc">Concise explanation of the relationships shown.</desc>
<rect width="1600" height="900" fill="#ffffff"/>
<!-- Reviewed, static vector elements only. -->
</svg>
For comparison charts, label values directly and start quantitative axes at zero unless an explicit analytical reason is disclosed in the caption. For terminal mocks, reproduce only sanitized output; never include secrets, tokens, home paths, customer data, or misleading commands.
Detect tools without installing anything:
command -v magick
command -v rsvg-convert
command -v inkscape
python3 -c 'import cairosvg; print(cairosvg.__version__)'
Example with trusted local paths:
magick -density 192 -background white figure.svg -resize 1600x figure.png
identify figure.png
Do not run package installers automatically. If no renderer exists, deliver the validated SVG and provide installation options for the owner to choose.
Local SVG creation, validation, and rasterization require no authentication and must not make network requests. CMS authentication is deliberately out of scope for this skill; pass the reviewed asset to the publishing workflow, which owns the target-specific secret and upload controls.
Require approval before inventing or altering brand tokens, changing sourced values, overwriting assets, installing software, uploading to a CMS, or publishing. A figure must not imply causation, scale, performance, price, or endorsement beyond its cited evidence.
Produce:
.svg path and SHA-256 digest.png path, dimensions, MIME type, and byte size| Condition | Response |
|---|---|
| Source data conflicts | Stop the chart, list the conflicting values and dates, and request an authoritative source. |
| SVG parser rejects the file | Do not rasterize or upload; repair the XML and rerun validation. |
| Active content is detected | Remove scripts, handlers, remote resources, and foreignObject; regenerate from safe primitives. |
| Labels clip or contrast fails | Adjust layout or palette, then inspect again at target width. |
| Rasterizer is unavailable | Return the validated SVG and an explicit unexecuted renderer recommendation. |
| Output path already exists | Use a new versioned filename or obtain overwrite approval. |
Create a source-backed process figure:
request: flow "Webhook delivery lifecycle"
steps: receive -> authenticate -> enqueue -> process -> acknowledge
source: approved article section "Delivery lifecycle"
outputs: webhook-delivery-lifecycle.svg, webhook-delivery-lifecycle.png
validation: XML clean; active content absent; 1600x900; alt text present
Refuse an unsupported comparison:
request: compare three vendors by reliability
result: blocked
reason: the article provides no comparable reliability measurement or source
next: supply an authoritative dataset or use a nonquantitative taxonomy
script, event attributes, javascript:, remote references, and foreignObject; expect none.Attach the figure receipt to the article review, then let the publishing workflow perform the separately approved upload and rendered-page verification.