SVG Creation Guide
Create clean, scalable SVG that is easy to edit, prints well, and survives “real-world” tooling (PowerPoint, browser, PDF export, HMI toolchains).
Working rules (keep SVG dependable)
- Use a
viewBox on every SVG.
- Keep geometry simple: prefer
path, rect, circle, line, polyline, polygon.
- Prefer strokes for technical drawings; prefer fills for pictograms.
- Use consistent naming and grouping:
id on key groups, class for reusable styling.
- Avoid renderer-fragile features unless asked:
- Avoid:
filter, mask, clipPath, foreignObject, blend modes, external images/fonts.
- Use gradients sparingly; keep them simple (
linearGradient/radialGradient).
- Keep decimal precision reasonable (typically 2–3 decimals). Do not over-optimize readability away.
Requirements to capture (ask only what matters)
Capture enough to produce the correct output on the first pass.
Target environment (drives compatibility)
- Web / inline HTML
- PowerPoint / Office
- HMI/SCADA tool (name/version if known)
- Engineering doc pipeline (PDF export, Visio, etc.)
Canvas + scale
- Desired physical size (mm/in) or slide size intent
- Coordinate system preference (e.g., “0–100 grid”, “millimeters”, “pixels”)
- Any snapping/grid requirements
Useful conversions (SVG assumes 96 DPI for CSS pixels):
- $1,\text{in} = 96,\text{px}$
- $1,\text{mm} = 96/25.4 \approx 3.7795,\text{px}$
Styling constraints
- Stroke widths (e.g., 1.5 for primary lines, 1.0 for secondary)
- Line caps/joins (round vs square)
- Color palette (include corporate colors if relevant)
- Light/dark background expectations
Content + semantics
- What objects exist (symbols, instruments, pipes, arrows, labels)
- Layering needs (background, pipework, instrumentation, callouts)
- Text rules (font family, size, casing, alignment)
Deliverables
- Number of variants (size/layout/color)
- Editable text vs outlined text requirements
- File naming convention and destination folder
Output patterns (choose the right one)
Pattern A: Technical diagram / P&ID style
Use strokes, consistent line weights, and a simple palette. Prefer vector-effect="non-scaling-stroke" when objects will be scaled.
Key tips:
- Keep symbols as
<g id="symbol-*"> groups.
- Use
stroke="currentColor" on symbols when you want themeable line art.
- Align to a grid; keep elbows crisp with
polyline.
Pattern B: PowerPoint/Office-friendly illustration
Prioritize compatibility:
- Prefer inline presentation attributes (
fill, stroke, stroke-width) over heavy CSS.
- Avoid: masks/filters, complex gradients,
marker arrows (Office support varies).
- Keep text as
<text> if the user wants to edit labels in PPT.
- If the user needs pixel-perfect portability, provide an “outlined” version (text converted to paths) and warn it is no longer editable.
Pattern C: HMI/SCADA widget
Design for clarity at small sizes and for interaction:
- Use generous hit areas (transparent rect with
fill="transparent" for click/touch zones).
- Keep state styling isolated (
.state-ok, .state-alarm, .state-disabled).
- Separate “skin” from “labels” so integrators can map tags and states.
SVG skeleton (recommended)
Use this as the default structure.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 200" width="300" height="200" role="img" aria-labelledby="title desc">
<title id="title">Diagram title</title>
<desc id="desc">Short description of what is shown</desc>
<defs>
<style>
.line { fill: none; stroke: #111827; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.thin { stroke-width: 1; }
.fill { fill: #F3F4F6; }
.text { fill: #111827; font-family: Arial, sans-serif; font-size: 12px; }
</style>
</defs>
<g id="layer-background"></g>
<g id="layer-geometry"></g>
<g id="layer-annotations"></g>
</svg>
If targeting PowerPoint/Office and compatibility is uncertain, repeat critical attributes inline on elements (Office can be picky about CSS).
Reference examples (copy/paste building blocks)
1) P&ID-style pipe with arrow and tag
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 80" width="240" height="80">
<g id="pipe" stroke="#111827" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round" vector-effect="non-scaling-stroke">
<polyline points="20,40 160,40" />
<!-- arrow head (Office-friendly: polygon instead of marker) -->
<polygon points="160,32 160,48 178,40" fill="#111827" stroke="none" />
</g>
<g id="tag">
<rect x="185" y="24" width="45" height="32" rx="6" fill="#FFFFFF" stroke="#111827" stroke-width="2" />
<text x="207.5" y="45" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#111827">P-101</text>
</g>
</svg>
2) Simple valve symbol (line-art)
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 40" width="120" height="40">
<g id="valve" stroke="#111827" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round" vector-effect="non-scaling-stroke">
<line x1="10" y1="20" x2="35" y2="20" />
<line x1="85" y1="20" x2="110" y2="20" />
<polygon points="35,8 60,20 35,32" />
<polygon points="85,8 60,20 85,32" />
</g>
</svg>
3) HMI button (states via classes)
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 220 70" width="220" height="70">
<defs>
<style>
.btn { stroke: #0F172A; stroke-width: 2; rx: 12; }
.ok { fill: #22C55E; }
.alarm { fill: #EF4444; }
.disabled { fill: #CBD5E1; }
.label { fill: #0F172A; font-family: Arial, sans-serif; font-size: 16px; font-weight: 700; }
</style>
</defs>
<g id="button" class="ok">
<rect class="btn ok" x="10" y="10" width="200" height="50" />
<text class="label" x="110" y="42" text-anchor="middle" dominant-baseline="middle">START</text>
<!-- hit area -->
<rect x="10" y="10" width="200" height="50" fill="transparent" />
</g>
</svg>
Quality checklist (run mentally before delivering)
- Include
viewBox; ensure shapes fit the viewBox with sane margins.
- Keep stroke widths consistent and intentional.
- Ensure text alignment is correct (
text-anchor, dominant-baseline).
- Keep groups layered predictably (
layer-*).
- Avoid external dependencies (no linked fonts/images) unless requested.
- If PowerPoint/Office is the target, avoid unsupported features and prefer inline attributes.
File outputs
When saving multiple variants, use a naming convention that encodes intent:
asset-name__v1__editable.svg
asset-name__v1__outlined.svg
asset-name__dark.svg
asset-name__light.svg
asset-name__scale-0-100.svg
Save files into a logical folder (e.g., assets/svg/ or a user-specified directory).
1---2name: svg3description: Create precise, production-ready SVG graphics for technical and business contexts (diagrams, P&IDs, HMI/SCADA widgets, process flow visuals, PowerPoint/Office illustrations, UI icons, annotations). Use when the user asks to generate, edit, standardize, optimize, or export SVG artwork; convert requirements (dimensions, scale, line weights, layers, symbols) into clean SVG markup; or produce multiple layout/variant files (editable vs outlined text, light/dark, monochrome).4---5
6# SVG Creation Guide
7
8Create clean, scalable SVG that is easy to edit, prints well, and survives “real-world” tooling (PowerPoint, browser, PDF export, HMI toolchains).
9
10## Working rules (keep SVG dependable)
11
12- Use a `viewBox` on every SVG.
13- Keep geometry simple: prefer `path`, `rect`, `circle`, `line`, `polyline`, `polygon`.
14- Prefer strokes for technical drawings; prefer fills for pictograms.
15- Use consistent naming and grouping: `id` on key groups, `class` for reusable styling.
16- Avoid renderer-fragile features unless asked:
17 - Avoid: `filter`, `mask`, `clipPath`, `foreignObject`, blend modes, external images/fonts.
18 - Use gradients sparingly; keep them simple (`linearGradient`/`radialGradient`).
19- Keep decimal precision reasonable (typically 2–3 decimals). Do not over-optimize readability away.
20
21## Requirements to capture (ask only what matters)
22
23Capture enough to produce the correct output on the first pass.
24
251. **Target environment** (drives compatibility)
26 - Web / inline HTML
27 - PowerPoint / Office
28 - HMI/SCADA tool (name/version if known)
29 - Engineering doc pipeline (PDF export, Visio, etc.)
30
312. **Canvas + scale**
32 - Desired physical size (mm/in) or slide size intent
33 - Coordinate system preference (e.g., “0–100 grid”, “millimeters”, “pixels”)
34 - Any snapping/grid requirements
35
36 Useful conversions (SVG assumes 96 DPI for CSS pixels):
37 - $1\,\text{in} = 96\,\text{px}$
38 - $1\,\text{mm} = 96/25.4 \approx 3.7795\,\text{px}$
39
403. **Styling constraints**
41 - Stroke widths (e.g., 1.5 for primary lines, 1.0 for secondary)
42 - Line caps/joins (round vs square)
43 - Color palette (include corporate colors if relevant)
44 - Light/dark background expectations
45
464. **Content + semantics**
47 - What objects exist (symbols, instruments, pipes, arrows, labels)
48 - Layering needs (background, pipework, instrumentation, callouts)
49 - Text rules (font family, size, casing, alignment)
50
515. **Deliverables**
52 - Number of variants (size/layout/color)
53 - Editable text vs outlined text requirements
54 - File naming convention and destination folder
55
56## Output patterns (choose the right one)
57
58### Pattern A: Technical diagram / P&ID style
59
60Use strokes, consistent line weights, and a simple palette. Prefer `vector-effect="non-scaling-stroke"` when objects will be scaled.
61
62Key tips:
63- Keep symbols as `<g id="symbol-*">` groups.
64- Use `stroke="currentColor"` on symbols when you want themeable line art.
65- Align to a grid; keep elbows crisp with `polyline`.
66
67### Pattern B: PowerPoint/Office-friendly illustration
68
69Prioritize compatibility:
70- Prefer inline presentation attributes (`fill`, `stroke`, `stroke-width`) over heavy CSS.
71- Avoid: masks/filters, complex gradients, `marker` arrows (Office support varies).
72- Keep text as `<text>` if the user wants to edit labels in PPT.
73- If the user needs pixel-perfect portability, provide an “outlined” version (text converted to paths) and warn it is no longer editable.
74
75### Pattern C: HMI/SCADA widget
76
77Design for clarity at small sizes and for interaction:
78- Use generous hit areas (transparent rect with `fill="transparent"` for click/touch zones).
79- Keep state styling isolated (`.state-ok`, `.state-alarm`, `.state-disabled`).
80- Separate “skin” from “labels” so integrators can map tags and states.
81
82## SVG skeleton (recommended)
83
84Use this as the default structure.
85
86```xml
87<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 200" width="300" height="200" role="img" aria-labelledby="title desc">
88 <title id="title">Diagram title</title>
89 <desc id="desc">Short description of what is shown</desc>
90
91 <defs>
92 <style>
93 .line { fill: none; stroke: #111827; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
94 .thin { stroke-width: 1; }
95 .fill { fill: #F3F4F6; }
96 .text { fill: #111827; font-family: Arial, sans-serif; font-size: 12px; }
97 </style>
98 </defs>
99
100 <g id="layer-background"></g>
101 <g id="layer-geometry"></g>
102 <g id="layer-annotations"></g>
103</svg>
104```
105
106If targeting PowerPoint/Office and compatibility is uncertain, repeat critical attributes inline on elements (Office can be picky about CSS).
107
108## Reference examples (copy/paste building blocks)
109
110### 1) P&ID-style pipe with arrow and tag
111
112```xml
113<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 80" width="240" height="80">
114 <g id="pipe" stroke="#111827" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round" vector-effect="non-scaling-stroke">
115 <polyline points="20,40 160,40" />
116 <!-- arrow head (Office-friendly: polygon instead of marker) -->
117 <polygon points="160,32 160,48 178,40" fill="#111827" stroke="none" />
118 </g>
119
120 <g id="tag">
121 <rect x="185" y="24" width="45" height="32" rx="6" fill="#FFFFFF" stroke="#111827" stroke-width="2" />
122 <text x="207.5" y="45" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#111827">P-101</text>
123 </g>
124</svg>
125```
126
127### 2) Simple valve symbol (line-art)
128
129```xml
130<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 40" width="120" height="40">
131 <g id="valve" stroke="#111827" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round" vector-effect="non-scaling-stroke">
132 <line x1="10" y1="20" x2="35" y2="20" />
133 <line x1="85" y1="20" x2="110" y2="20" />
134 <polygon points="35,8 60,20 35,32" />
135 <polygon points="85,8 60,20 85,32" />
136 </g>
137</svg>
138```
139
140### 3) HMI button (states via classes)
141
142```xml
143<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 220 70" width="220" height="70">
144 <defs>
145 <style>
146 .btn { stroke: #0F172A; stroke-width: 2; rx: 12; }
147 .ok { fill: #22C55E; }
148 .alarm { fill: #EF4444; }
149 .disabled { fill: #CBD5E1; }
150 .label { fill: #0F172A; font-family: Arial, sans-serif; font-size: 16px; font-weight: 700; }
151 </style>
152 </defs>
153
154 <g id="button" class="ok">
155 <rect class="btn ok" x="10" y="10" width="200" height="50" />
156 <text class="label" x="110" y="42" text-anchor="middle" dominant-baseline="middle">START</text>
157 <!-- hit area -->
158 <rect x="10" y="10" width="200" height="50" fill="transparent" />
159 </g>
160</svg>
161```
162
163## Quality checklist (run mentally before delivering)
164
165- Include `viewBox`; ensure shapes fit the viewBox with sane margins.
166- Keep stroke widths consistent and intentional.
167- Ensure text alignment is correct (`text-anchor`, `dominant-baseline`).
168- Keep groups layered predictably (`layer-*`).
169- Avoid external dependencies (no linked fonts/images) unless requested.
170- If PowerPoint/Office is the target, avoid unsupported features and prefer inline attributes.
171
172## File outputs
173
174When saving multiple variants, use a naming convention that encodes intent:
175
176- `asset-name__v1__editable.svg`
177- `asset-name__v1__outlined.svg`
178- `asset-name__dark.svg`
179- `asset-name__light.svg`
180- `asset-name__scale-0-100.svg`
181
182Save files into a logical folder (e.g., `assets/svg/` or a user-specified directory).