Loading...
Loading...
根据自然语言描述生成 SVG 代码。支持流程图、卡片、图表、图标等常用图形,输出可直接在浏览器中查看的 SVG 文件。当用户提到 SVG、生成图片、图形、图标、流程图时触发。
npx skill4agent add bewatermyfriend7/skill-project svg-generator用户描述 → 解析需求 → 设计图形 → 生成 SVG 代码 → 验证输出 → 保存文件画布高度 = 标题高度(40) + 内容总高度 + 节点间距 × (节点数-1) + 图例说明区高度(如有) + 边距(60-80)viewBox.svgexamples/test.svgexamples/complex-flow.svg| 用途 | 颜色代码 |
|---|---|
| 背景色 | |
| 卡片背景 | |
| 标题文字 | |
| 正文文字 | |
| 边框色 | |
| 箭头颜色 | |
examples/rd-lifecycle-flow.svgexamples/rd-timeline.svg| 用途 | 颜色代码 |
|---|---|
| 背景色 | |
| 卡片背景 | |
| 标题文字 | |
| 正文文字 | |
| 边框色 | |
| 箭头颜色 | |
| 用途 | 颜色代码 |
|---|---|
| 主色(蓝) | |
| 成功(绿) | |
| 警告(橙) | |
| 错误(红) | |
| 紫色 | |
| 青色 | |
| 黄色 | |
| 青色2 | |
rgba(0,0,0,0.4)| 用途 | 颜色代码 |
|---|---|
| 主色(蓝色) | |
| 辅助色(绿色) | |
| 强调色(橙色) | |
| 警示色(红色) | |
| 背景色 | |
| 文字色 | |
| 边框色 | |
| 箭头颜色 | |
| 项目 | 浅色模式默认值 | 深色模式默认值 |
|---|---|---|
| 画布尺寸 | 800×600 | 800×600 |
| 圆角半径 | 8px(卡片) | 8px(卡片) |
| 阴影 | | |
| 边框宽度 | 2px | 2-3px |
| 字体 | | |
| 线条粗细 | 2px | 2px |
| 箭头大小 | markerWidth=6, markerHeight=4 | markerWidth=6, markerHeight=4 |
<!-- 推荐:使用单一矩形,标题通过覆盖层实现 -->
<rect x="100" y="100" width="140" height="60" rx="8"
fill="#ffffff" stroke="#3498db" stroke-width="2"/>
<!-- 标题背景 -->
<path d="M100 108 Q100 100 108 100 L132 100 Q140 100 140 108 L140 118 Q140 126 132 126 L108 126 Q100 126 100 118 Z"
fill="#3498db"/>
<text x="120" y="118" text-anchor="middle" font-size="12" fill="#fff">标题</text><!-- 推荐:简洁设计,不使用拼接 -->
<rect x="100" y="100" width="140" height="60" rx="8"
fill="#ffffff" stroke="#3498db" stroke-width="2"/>
<text x="120" y="125" text-anchor="middle" font-size="14" font-weight="bold" fill="#333">节点名称</text><!-- 圆角矩形卡片 -->
<rect x="100" y="100" width="140" height="60" rx="8"
fill="#fff" stroke="#3498db" stroke-width="2"
filter="url(#shadow)"/>
<!-- 圆形节点 -->
<circle cx="200" cy="200" r="30"
fill="#fff" stroke="#3498db" stroke-width="2"/><!-- 灰色箭头(推荐用于连接线) -->
<marker id="arrowhead" markerWidth="6" markerHeight="4" refX="5" refY="2" orient="auto">
<polygon points="0 0, 6 2, 0 4" fill="#999999"/>
</marker>
<!-- 蓝色箭头(可用于强调流程主线) -->
<marker id="arrowhead-blue" markerWidth="6" markerHeight="4" refX="5" refY="2" orient="auto">
<polygon points="0 0, 6 2, 0 4" fill="#3498db"/>
</marker>
<!-- 红色箭头(错误分支) -->
<marker id="arrowhead-red" markerWidth="6" markerHeight="4" refX="5" refY="2" orient="auto">
<polygon points="0 0, 6 2, 0 4" fill="#e74c3c"/>
</marker>
<!-- 连接线 -->
<line x1="240" y1="130" x2="340" y2="130"
stroke="#999999" stroke-width="2" marker-end="url(#arrowhead)"/><!-- 菱形判断节点 -->
<polygon points="200,100 240,140 200,180 160,140"
fill="#fff" stroke="#e67e22" stroke-width="2" filter="url(#shadow)"/>
<text x="200" y="145" text-anchor="middle" font-size="12" fill="#333">判断条件</text>
<!-- 折线连接(路径转向) -->
<path d="M 250 150 L 250 180 L 180 180 L 180 210"
fill="none" stroke="#999999" stroke-width="2" marker-end="url(#arrowhead)"/>
<!-- 虚线连接(异步/错误分支) -->
<line x1="100" y1="130" x2="200" y2="130"
stroke="#e74c3c" stroke-width="2" stroke-dasharray="5,5"
marker-end="url(#arrowhead-red)"/>
<!-- 虚线框(可选区域) -->
<rect x="50" y="200" width="200" height="120" rx="8"
fill="none" stroke="#999999" stroke-width="1" stroke-dasharray="5,5"/>
<text x="60" y="220" font-size="10" fill="#999">可选流程区域</text>
<!-- 汇聚点 -->
<circle cx="300" cy="400" r="6" fill="#666"/>
<text x="320" y="405" font-size="10" fill="#666">汇聚点</text>
<!-- 曲线连接(循环/回退) -->
<path d="M 250 200 C 250 250, 150 250, 150 300"
fill="none" stroke="#9b59b6" stroke-width="2"
stroke-dasharray="5,5" marker-end="url(#arrowhead-blue)"/><!-- 柔和背景 -->
<rect width="800" height="600" fill="#f8f9fa"/>
<!-- 光点装饰 -->
<circle cx="100" cy="100" r="20" fill="#3498db" opacity="0.1"/><svg xmlns="http://www.w3.org/2000/svg"
width="800" height="600" viewBox="0 0 800 600">
<defs>
<!-- 阴影滤镜 -->
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="3" stdDeviation="6" flood-opacity="0.1"/>
</filter>
<!-- 箭头标记 - 统一使用灰色箭头 -->
<marker id="arrowhead" markerWidth="6" markerHeight="4" refX="5" refY="2" orient="auto">
<polygon points="0 0, 6 2, 0 4" fill="#999999"/>
</marker>
</defs>
<!-- 背景 -->
<rect width="800" height="600" fill="#f8f9fa"/>
<!-- 标题 -->
<text x="400" y="30" text-anchor="middle" font-size="20" font-weight="bold" fill="#333333">标题</text>
<!-- 你的图形内容 -->
...
</svg><svg xmlns="http://www.w3.org/2000/svg"
width="800" height="600" viewBox="0 0 800 600">
<defs>
<!-- 深色模式箭头 -->
<marker id="arrowhead" markerWidth="5" markerHeight="5" refX="5" refY="2.5" orient="auto">
<polygon points="0 0, 5 2.5, 0 5" fill="#666"/>
</marker>
</defs>
<!-- 深色背景 -->
<rect width="800" height="600" fill="#1a1a2e"/>
<!-- 标题 -->
<text x="400" y="30" text-anchor="middle" font-size="20" font-weight="bold" fill="#ffffff">标题</text>
<!-- 卡片示例 -->
<rect x="100" y="80" width="140" height="60" rx="5" fill="#16213e" stroke="#3498db" stroke-width="2"/>
<text x="170" y="115" text-anchor="middle" font-size="12" fill="#aaaaaa">节点内容</text>
<!-- 你的图形内容 -->
...
</svg>| 元素 | 颜色代码 |
|---|---|
| 背景 | |
| 卡片背景 | |
| 标题文字 | |
| 正文文字 | |
| 边框 | |
| 箭头 | |
| 主色边框 | |
| 成功色 | |
| 错误色 | |
.svg<svg xmlns="http://www.w3.org/2000/svg" width="800" height="400" viewBox="0 0 800 400">
<defs>
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="3" stdDeviation="6" flood-opacity="0.1"/>
</filter>
<marker id="arrowhead" markerWidth="6" markerHeight="4" refX="5" refY="2" orient="auto">
<polygon points="0 0, 6 2, 0 4" fill="#999999"/>
</marker>
</defs>
<rect width="800" height="400" fill="#f8f9fa"/>
<text x="400" y="30" text-anchor="middle" font-size="20" font-weight="bold" fill="#333333">三步流程图</text>
<!-- 步骤1:需求分析 -->
<g transform="translate(100, 150)">
<rect width="160" height="80" rx="8" fill="#fff" stroke="#3498db" stroke-width="2" filter="url(#shadow)"/>
<text x="80" y="45" text-anchor="middle" font-size="14" fill="#666">🔍</text>
<text x="80" y="65" text-anchor="middle" font-size="14" font-weight="bold" fill="#333">需求分析</text>
</g>
<!-- 箭头1 - 使用统一灰色箭头 -->
<line x1="270" y1="190" x2="350" y2="190" stroke="#999999" stroke-width="2" marker-end="url(#arrowhead)"/>
<!-- 步骤2:设计开发 -->
<g transform="translate(360, 150)">
<rect width="160" height="80" rx="8" fill="#fff" stroke="#2ecc71" stroke-width="2" filter="url(#shadow)"/>
<text x="80" y="45" text-anchor="middle" font-size="14" fill="#666">🎨</text>
<text x="80" y="65" text-anchor="middle" font-size="14" font-weight="bold" fill="#333">设计开发</text>
</g>
<!-- 箭头2 - 使用统一灰色箭头 -->
<line x1="530" y1="190" x2="610" y2="190" stroke="#999999" stroke-width="2" marker-end="url(#arrowhead)"/>
<!-- 步骤3:测试上线 -->
<g transform="translate(620, 150)">
<rect width="160" height="80" rx="8" fill="#fff" stroke="#e67e22" stroke-width="2" filter="url(#shadow)"/>
<text x="80" y="45" text-anchor="middle" font-size="14" fill="#666">🚀</text>
<text x="80" y="65" text-anchor="middle" font-size="14" font-weight="bold" fill="#333">测试上线</text>
</g>
</svg><svg xmlns="http://www.w3.org/2000/svg" width="800" height="600" viewBox="0 0 800 600">
<defs>
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="3" stdDeviation="6" flood-opacity="0.1"/>
</filter>
<marker id="arrowhead" markerWidth="6" markerHeight="4" refX="5" refY="2" orient="auto">
<polygon points="0 0, 6 2, 0 4" fill="#999999"/>
</marker>
</defs>
<rect width="800" height="600" fill="#f8f9fa"/>
<text x="400" y="30" text-anchor="middle" font-size="20" font-weight="bold" fill="#333333">用户登录流程图</text>
<!-- 步骤1 -->
<g transform="translate(330, 60)">
<rect width="140" height="50" rx="8" fill="#fff" stroke="#3498db" stroke-width="2" filter="url(#shadow)"/>
<text x="70" y="32" text-anchor="middle" font-size="13" font-weight="bold" fill="#333">打开登录页面</text>
</g>
<!-- 箭头 -->
<line x1="400" y1="110" x2="400" y2="135" stroke="#999999" stroke-width="2" marker-end="url(#arrowhead)"/>
<!-- 更多步骤... -->
</svg><svg xmlns="http://www.w3.org/2000/svg" width="1000" height="800" viewBox="0 0 1000 800">
<defs>
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="3" stdDeviation="6" flood-opacity="0.1"/>
</filter>
<marker id="arrowhead" markerWidth="6" markerHeight="4" refX="5" refY="2" orient="auto">
<polygon points="0 0, 6 2, 0 4" fill="#999999"/>
</marker>
</defs>
<rect width="1000" height="800" fill="#f8f9fa"/>
<text x="500" y="30" text-anchor="middle" font-size="22" font-weight="bold" fill="#333333">系统架构图</text>
<!-- 接入层 -->
<g>
<text x="100" y="70" font-size="14" font-weight="bold" fill="#3498db">① 接入层</text>
<rect x="100" y="80" width="900" height="70" rx="8" fill="#fff" stroke="#e0e0e0" stroke-width="1"/>
<!-- 组件... -->
</g>
<!-- 箭头到服务层(可选:分层架构图中箭头可根据需要添加) -->
<!-- <line x1="500" y1="150" x2="500" y2="175" stroke="#999999" stroke-width="2" marker-end="url(#arrowhead)"/> -->
<!-- 服务层 -->
<g>
<text x="100" y="195" font-size="14" font-weight="bold" fill="#2ecc71">② 服务层</text>
<rect x="100" y="205" width="800" height="120" rx="8" fill="#fff" stroke="#e0e0e0" stroke-width="1"/>
<!-- 组件... -->
</g>
<!-- 更多层级... -->
</svg><path>.svg