My New Hugo Site

  1. Bash
    1. Filters
      1. grep
      2. Sed
      3. jq
    2. Shellspec
  2. Design
  3. Architectural Patterns
    1. Systemd
    2. Message Broker
    3. JSON-RPC
  4. Go
    1. Concurrency
    2. Web Applications
    3. Compound Data
    4. Json
    5. Go vs Erlang
  5. Prolog Cookbook
  6. Documentation
    1. Hugo
      1. Go Html Template
      2. Table of Contents
    2. HTML
    3. CSS
      1. Color
      2. Style Guides
      3. Layout
    4. Mathjax
  7. Visualization
    1. D3
      1. Venn Diagrams
    2. SVG
    3. Visjs
      1. Network
  8. Data
    1. Yaml
    2. Events
      1. JSON-LD
    3. JSON
      1. jCal
    4. SQL
  9. JavaScript

SVG

SVG in HTML

SVG
<svg width="30%" viewBox="0 0 300 200" preserveAspectRatio="xMidYMid meet">
  <rect width="100%" height="100%" fill="red" />
  <circle cx="150" cy="100" r="80" fill="green" />
  <text x="150" y="125" font-size="60" text-anchor="middle" fill="white">SVG</text>
</svg>

viewBox=“min-x min-y width height”

The bounds given to viewBox are not the same as the displayed image size, which needs to be set with width and/or height.

preserveAspectRatio="<align> [<meetOrSlice>]"

Basic Shapes

Text

Paths

<svg width="325" height="325">
  <path d="M 80 80
           A 45 45, 0, 0, 0, 125 125
           L 125 80 Z" fill="green"/>
  <path d="M 230 80
           A 45 45, 0, 1, 0, 275 125
           L 275 80 Z" fill="red"/>
  <path d="M 80 230
           A 45 45, 0, 0, 1, 125 275
           L 125 230 Z" fill="purple"/>
  <path d="M 230 230
           A 45 45, 0, 1, 1, 275 275
           L 275 230 Z" fill="blue"/>
</svg>
M x y
Move to x y
L x y
Line to x y from current position
H x
Horizontal line to x
V y
Vertical line to y
Z
Close shape by drawing line to start
C x1 y1, x2 y2, x y
Bézier Curve
S x2 y2, x y
Added Bézier Curve (x1 y1 is previous x y)
Q x1 y1, x y
Quadratic Bézier Curve
T x y
Added Quadratic Bézier Curve
A rx ry x-axis-rotation large-arc-flag sweep-flag x y
Arc

Fills and Strokes