PSSVG
PSSVG copied to clipboard
Script SVGs with PowerShell
PowerShell tools for SVG.
PSSVG helps you create Scalable Vector Graphics using PowerShell.
There is a command for every tag of the SVG standard (and then some).
For example, this script generates the image below it.
svg (
svg.text -X 50% -Y 50% -Fontsize 36 "Hello World" -DominantBaseline middle -TextAnchor middle -Fill '#4488ff'
) -ViewBox 0,0, 200, 100
PSSVG has a lot cooler Examples than hello world:
Example Name | Image |
---|---|
Animate | Animate.svg |
AnimateColor | AnimateColor.svg |
AnimatedShapes | AnimatedShapes.svg |
AnimateMotion | AnimateMotion.svg |
Blur | Blur.svg |
BPMAnimate | BPMAnimate.svg |
BPMMorph | BPMMorph.svg |
BPMTriangleMorph | BPMTriangleMorph.svg |
Circles | Circles.svg |
CloudAnimation | CloudAnimation.svg |
Clouds | Clouds.svg |
DropShadow | DropShadow.svg |
Embossed | Embossed.svg |
FadeIn | FadeIn.svg |
HelloWorld | HelloWorld.svg |
HexagonPattern | HexagonPattern.svg |
Index | Index.svg |
LinearGradient | LinearGradient.svg |
LinearGradientAnimated | LinearGradientAnimated.svg |
ManyAnimatedRectangles | ManyAnimatedRectangles.svg |
ManyRectangles | ManyRectangles.svg |
Morphing | Morphing.svg |
MovingGradient | MovingGradient.svg |
MovingShadows | |
Pattern | Pattern.svg |
PatternAnimation | PatternAnimation.svg |
PatternMask | PatternMask.svg |
PowerShellChevron | PowerShellChevron.svg |
RadialGradient | RadialGradient.svg |
RadialGradientAnimated | RadialGradientAnimated.svg |
RepeatedShapes | RepeatedShapes3.svg RepeatedShapes4.svg RepeatedShapes5.svg RepeatedShapes6.svg |
Shapes | Shapes.svg |
SpinningSpiral | SpinningSpiral15.svg SpinningSpiral636.svg SpinningSpiral741.svg SpinningSpiral901.svg |
StarRating | StarRating.svg |
Stars | Stars.svg Stars10.svg Stars11.svg Stars12.svg Stars5.svg Stars6.svg Stars7.svg Stars8.svg Stars9.svg |
StartAutomating | StartAutomating.svg |
StopUsingGIFs | StopUsingGIFs.svg |
SweepCircle | SweepCircle.svg |
US-Flag | US-Flag.svg |
US-FlagAnimated | US-FlagAnimated.svg |
VerticalLinearGradient | VerticalLinearGradient.svg |
ViewBoxAnimation | ViewBoxAnimation.svg |
PSSVG is designed to act as a fairly complete domain specific language: every aspect of the SVG standard should be reflected in the commands of PSSVG.
The following commands are supported:
Element | Function | Aliases |
---|---|---|
a | SVG.a | =<svg.a> |
animate | SVG.animate | =<svg.animate> |
animateMotion | SVG.animateMotion | =<svg.animateMotion> |
animateTransform | SVG.animateTransform | =<svg.animateTransform> |
ANSI | SVG.ANSI | =<svg.ANSI> |
ArcPath | SVG.ArcPath | =<SVG.ArcedPath> =<svg.ArcPath> SVG.ArcedPath |
circle | SVG.circle | =<svg.circle> |
clipPath | SVG.clipPath | =<svg.clipPath> |
ConvexPolygon | SVG.ConvexPolygon | =<svg.ConvexPolygon> SVG.Decagon SVG.Dodecagon SVG.Enneadecagon SVG.Hendecagon SVG.Heptadecagon SVG.Heptagon SVG.Hexadecagon SVG.Hexagon SVG.Icosagon SVG.Icosikaidigon SVG.Icosikaienneagon SVG.Icosikaihenagon SVG.Icosikaiheptagon SVG.Icosikaihexagon SVG.Icosikaioctagon SVG.Icosikaipentagon SVG.Icositetragon SVG.Icositrigon SVG.Nonagon SVG.Octadecagon SVG.Octagon SVG.Pentadecagon SVG.Pentagon SVG.Tetradecagon SVG.Triacontagon SVG.Tridecagon |
CurvePath | SVG.CurvePath | =<SVG.CurvedPath> =<svg.CurvePath> SVG.CurvedPath |
defs | SVG.defs | =<svg.defs> |
desc | SVG.desc | =<svg.desc> |
discard | SVG.discard | =<svg.discard> |
DropShadow | SVG.DropShadow | =<svg.DropShadow> |
ellipse | SVG.ellipse | =<svg.ellipse> |
feBlend | SVG.feBlend | =<svg.feBlend> |
feColorMatrix | SVG.feColorMatrix | =<svg.feColorMatrix> |
feComponentTransfer | SVG.feComponentTransfer | =<svg.feComponentTransfer> |
feComposite | SVG.feComposite | =<svg.feComposite> |
feConvolveMatrix | SVG.feConvolveMatrix | =<svg.feConvolveMatrix> |
feDiffuseLighting | SVG.feDiffuseLighting | =<svg.feDiffuseLighting> |
feDisplacementMap | SVG.feDisplacementMap | =<svg.feDisplacementMap> |
feDistantLight | SVG.feDistantLight | =<svg.feDistantLight> |
feDropShadow | SVG.feDropShadow | =<svg.feDropShadow> |
feFlood | SVG.feFlood | =<svg.feFlood> |
feFuncA | SVG.feFuncA | =<svg.feFuncA> |
feFuncB | SVG.feFuncB | =<svg.feFuncB> |
feFuncG | SVG.feFuncG | =<svg.feFuncG> |
feFuncR | SVG.feFuncR | =<svg.feFuncR> |
feGaussianBlur | SVG.feGaussianBlur | =<svg.feGaussianBlur> |
feImage | SVG.feImage | =<svg.feImage> |
feMerge | SVG.feMerge | =<svg.feMerge> |
feMergeNode | SVG.feMergeNode | =<svg.feMergeNode> |
feMorphology | SVG.feMorphology | =<svg.feMorphology> |
feOffset | SVG.feOffset | =<svg.feOffset> |
fePointLight | SVG.fePointLight | =<svg.fePointLight> |
feSpecularLighting | SVG.feSpecularLighting | =<svg.feSpecularLighting> |
feSpotLight | SVG.feSpotLight | =<svg.feSpotLight> |
feTile | SVG.feTile | =<svg.feTile> |
feTurbulence | SVG.feTurbulence | =<svg.feTurbulence> |
filter | SVG.filter | =<svg.filter> |
foreignObject | SVG.foreignObject | =<svg.foreignObject> |
g | SVG.g | =<svg.g> |
GoogleFont | SVG.GoogleFont | =<svg.GoogleFont> |
image | SVG.image | =<svg.image> |
Kite | SVG.Kite | =<svg.Kite> SVG.Rhombuses |
line | SVG.line | =<svg.line> |
linearGradient | SVG.linearGradient | =<svg.linearGradient> |
LinePath | SVG.LinePath | =<SVG.LinedPath> =<svg.LinePath> SVG.LinedPath |
marker | SVG.marker | =<svg.marker> |
mask | SVG.mask | =<svg.mask> |
metadata | SVG.metadata | =<svg.metadata> |
mpath | SVG.mpath | =<svg.mpath> |
path | SVG.path | =<svg.path> |
pattern | SVG.pattern | =<svg.pattern> |
polygon | SVG.polygon | =<svg.polygon> |
polyline | SVG.polyline | =<svg.polyline> |
radialGradient | SVG.radialGradient | =<svg.radialGradient> |
rect | SVG.rect | =<svg.rect> |
Rhombus | SVG.Rhombus | =<svg.Rhombus> SVG.Rhombi |
script | SVG.script | =<svg.script> |
set | SVG.set | =<svg.set> |
Spiral | SVG.Spiral | =<svg.Spiral> |
Star | SVG.Star | =<svg.Star> |
stop | SVG.stop | =<svg.stop> |
style | SVG.style | =<svg.style> |
StyleSheet | SVG.StyleSheet | =<svg.StyleSheet> |
svg | SVG.svg | =<svg> svg |
switch | SVG.switch | =<svg.switch> |
symbol | SVG.symbol | =<svg.symbol> |
text | SVG.text | =<svg.text> |
textPath | SVG.textPath | =<svg.textPath> |
title | SVG.title | =<svg.title> |
Triangle | SVG.Triangle | =<svg.Triangle> |
tspan | SVG.tspan | =<svg.tspan> |
use | SVG.use | =<svg.use> |
view | SVG.view | =<svg.view> |
(elements marked deprecated are not supported)
Goals
PSSVG hopes to be a useful toolkit for generating SVG images from PowerShell.
SVG has many benefits as an image file format, for example:
- File Size
- Scalability
- Animations
- Clickability
- HTML/JavaScript/CSS integration
- OS Integration
However, it is not a complete programming language.
Thus the primary goal is to make SVG creation scriptable.
Limitations
At current, PSSVG does not support aria attributes. Events can be generically specified with the parameter -On.
How PSSVG is Built
In order to provide an ideal PowerShell experience with rich help,
PSSVG is currently built by reading the contents of the Mozilla Developer Network's content repository.
It uses two PowerShell modules to read the repository and create the commands:
- Irregular is used to help parse the markdown contents of the repository
- PipeScript is used to create the functions from the parsed data.