diff --git a/admin/public/favicon.svg b/admin/public/favicon.svg
index 6893eb1..c9ca516 100644
--- a/admin/public/favicon.svg
+++ b/admin/public/favicon.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/admin/public/logo.svg b/admin/public/logo.svg
new file mode 100644
index 0000000..e7df26e
--- /dev/null
+++ b/admin/public/logo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/assets.go b/assets/assets.go
new file mode 100644
index 0000000..c182dd7
--- /dev/null
+++ b/assets/assets.go
@@ -0,0 +1,19 @@
+// Package assets holds the Parsimony logo. The files are generated by make-logo.py.
+package assets
+
+import _ "embed"
+
+// Mark is the square mark: an envelope in a rounded square. It is also the favicon.
+//
+//go:embed logo-mark.svg
+var Mark string
+
+// Logo is the mark with the wordmark, for light backgrounds.
+//
+//go:embed logo.svg
+var Logo string
+
+// LogoDark is the mark with the wordmark, for dark backgrounds.
+//
+//go:embed logo-dark.svg
+var LogoDark string
diff --git a/assets/assets_test.go b/assets/assets_test.go
new file mode 100644
index 0000000..2a1db66
--- /dev/null
+++ b/assets/assets_test.go
@@ -0,0 +1,123 @@
+package assets
+
+import (
+ "bytes"
+ "encoding/xml"
+ "io"
+ "os"
+ "strings"
+ "testing"
+)
+
+var files = map[string]string{"logo-mark.svg": Mark, "logo.svg": Logo, "logo-dark.svg": LogoDark}
+
+func TestLogosAreWellFormedSVG(t *testing.T) {
+ for name, src := range files {
+ if src == "" {
+ t.Fatalf("%s is empty", name)
+ }
+ dec := xml.NewDecoder(strings.NewReader(src))
+ var root *xml.StartElement
+ for {
+ tok, err := dec.Token()
+ if err == io.EOF {
+ break
+ }
+ if err != nil {
+ t.Fatalf("%s: %v", name, err)
+ }
+ if se, ok := tok.(xml.StartElement); ok && root == nil {
+ se := se
+ root = &se
+ }
+ }
+ if root == nil || root.Name.Local != "svg" || root.Name.Space != "http://www.w3.org/2000/svg" {
+ t.Fatalf("%s: root element %+v", name, root)
+ }
+ attrs := map[string]string{}
+ for _, a := range root.Attr {
+ attrs[a.Name.Local] = a.Value
+ }
+ if attrs["viewBox"] == "" || attrs["role"] != "img" || attrs["aria-label"] != "Parsimony" {
+ t.Errorf("%s: it must scale (viewBox) and be named for screen readers: %v", name, attrs)
+ }
+ if attrs["width"] != "" || attrs["height"] != "" {
+ t.Errorf("%s: no fixed size: the page decides", name)
+ }
+ }
+}
+
+func TestLogosNeedNothingFromOutside(t *testing.T) {
+ // Inline in a page with a strict CSP, in a README, on a dark background: no fonts, scripts, images or links.
+ for name, src := range files {
+ for _, bad := range []string{" 4000 {
+ t.Errorf("%s is %d bytes: a logo should stay tiny", name, len(src))
+ }
+ }
+}
+
+func TestTheWordmarkLogosDifferOnlyInColour(t *testing.T) {
+ strip := func(s string) string {
+ for _, c := range []string{"#0f172a", "#ffffff", "#0f766e", "#2dd4bf"} {
+ s = strings.ReplaceAll(s, c, "#")
+ }
+ return s
+ }
+ if strip(Logo) != strip(LogoDark) {
+ t.Fatal("the light and dark logos must have the same shapes")
+ }
+ if Logo == LogoDark {
+ t.Fatal("the dark logo must use light colours")
+ }
+ if !strings.Contains(LogoDark, "#ffffff") || strings.Contains(LogoDark, "#0f172a") {
+ t.Fatal("the dark logo draws the letters in white, not in the dark ink")
+ }
+ if !strings.Contains(Logo, "#0f172a") {
+ t.Fatal("the light logo draws the letters in the dark ink")
+ }
+}
+
+func TestTheAdminUIShipsTheSameLogos(t *testing.T) {
+ for public, want := range map[string]string{"../admin/public/favicon.svg": Mark, "../admin/public/logo.svg": Logo} {
+ got, err := os.ReadFile(public)
+ if err != nil {
+ t.Fatalf("%s: %v (copy it from assets/)", public, err)
+ }
+ if !bytes.Equal(got, []byte(want)) {
+ t.Errorf("%s differs from the file in assets/: run `python3 assets/make-logo.py assets` and copy it", public)
+ }
+ }
+}
+
+// The mark is white on teal: that pair must stay readable (WCAG AA for graphics asks 3:1).
+func TestTheMarkHasEnoughContrast(t *testing.T) {
+ lum := func(hex string) float64 {
+ var r, g, b int
+ if _, err := fmtSscanf(hex, &r, &g, &b); err != nil {
+ t.Fatal(err)
+ }
+ f := func(c int) float64 {
+ v := float64(c) / 255
+ if v <= 0.03928 {
+ return v / 12.92
+ }
+ return pow((v+0.055)/1.055, 2.4)
+ }
+ return 0.2126*f(r) + 0.7152*f(g) + 0.0722*f(b)
+ }
+ l1, l2 := lum("#ffffff"), lum("#0f766e")
+ if ratio := (l1 + 0.05) / (l2 + 0.05); ratio < 4.5 {
+ t.Fatalf("contrast %.2f:1", ratio)
+ }
+ if !strings.Contains(Mark, "#0f766e") || !strings.Contains(Mark, "#ffffff") {
+ t.Fatal("the contrast test checks the colours the mark really uses")
+ }
+}
diff --git a/assets/helpers_test.go b/assets/helpers_test.go
new file mode 100644
index 0000000..1d9e79e
--- /dev/null
+++ b/assets/helpers_test.go
@@ -0,0 +1,11 @@
+package assets
+
+import (
+ "fmt"
+ "math"
+)
+
+func fmtSscanf(hex string, r, g, b *int) (int, error) {
+ return fmt.Sscanf(hex, "#%02x%02x%02x", r, g, b)
+}
+func pow(x, y float64) float64 { return math.Pow(x, y) }
diff --git a/assets/logo-dark.svg b/assets/logo-dark.svg
new file mode 100644
index 0000000..09d7633
--- /dev/null
+++ b/assets/logo-dark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/logo-mark.svg b/assets/logo-mark.svg
new file mode 100644
index 0000000..c9ca516
--- /dev/null
+++ b/assets/logo-mark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/logo.svg b/assets/logo.svg
new file mode 100644
index 0000000..e7df26e
--- /dev/null
+++ b/assets/logo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/make-logo.py b/assets/make-logo.py
new file mode 100644
index 0000000..35a9e72
--- /dev/null
+++ b/assets/make-logo.py
@@ -0,0 +1,85 @@
+# Generates the Parsimony logo files: python3 assets/make-logo.py assets
+# The wordmark is drawn with monoline strokes, not typeset: it needs no font and looks the same everywhere.
+# The mark is an envelope in a rounded square; the dot of the i echoes it in the accent colour.
+import math, sys
+
+INK, TEAL, WHITE = "#0f172a", "#0f766e", "#ffffff"
+SW = 4.4 # stroke width of the letters
+H = 24 # x-height
+B = 40 # baseline y in the wordmark box
+T = B - H
+GAP = 8.5
+
+def circle(cx, cy, r): return f''
+def path(d): return f''
+
+def letter(ch):
+ """returns (svg elements, advance width) with x from 0"""
+ if ch == "o": return circle(12, B-12, 12), 24
+ if ch == "a": return circle(12, B-12, 12) + path(f"M24 {T}V{B}"), 24
+ if ch == "p": return path(f"M0 {T}V{B+14}") + circle(12, B-12, 12), 24
+ if ch == "n": return path(f"M0 {T}V{B}") + path(f"M0 {T+12}A12 12 0 0 1 24 {T+12}V{B}"), 24
+ if ch == "m": return path(f"M0 {T}V{B}") + path(f"M0 {T+10}A10 10 0 0 1 20 {T+10}V{B}") + path(f"M20 {T+10}A10 10 0 0 1 40 {T+10}V{B}"), 40
+ if ch == "r": return path(f"M0 {T}V{B}") + path(f"M0 {T+13}A13 13 0 0 1 13 {T}"), 13
+ if ch == "i": return path(f"M0 {T}V{B}") + f'', 0
+ if ch == "y": return path(f"M0 {T}L12.6 {B}") + path(f"M24 {T}L6 {B+14}"), 24
+ if ch == "s":
+ d = (f"M18 {T+5}C15 {T+1} 11 {T} 9 {T}C4 {T} 2 {T+3.5} 2 {T+6.5}C2 {T+11} 7 {T+12} 10.5 {T+13}"
+ f"C15 {T+14} 18 {T+16} 18 {T+19}C18 {T+22.5} 14 {B} 9 {B}C5 {B} 2 {B-1.5} 1 {B-5}")
+ return path(d), 18
+ raise ValueError(ch)
+
+def wordmark(text="parsimony"):
+ kern = {("r", "s"): -4.0, ("p", "a"): -0.5}
+ x = 0; out = []; prev = None
+ for ch in text:
+ x += kern.get((prev, ch), 0)
+ svg, w = letter(ch)
+ out.append(f'{svg}')
+ x += w + GAP
+ prev = ch
+ return "".join(out), x - GAP
+
+def envelope(cx, cy, w=30, h=22, sw=4):
+ """envelope outline with its flap, centred on cx,cy"""
+ x0, y0, x1, y1 = cx-w/2, cy-h/2, cx+w/2, cy+h/2
+ f = lambda v: f"{v:g}"
+ return (f''
+ f'')
+
+def mark_svg(bg=True, fg=WHITE, bgc=TEAL):
+ s = f''
+ return s
+
+def logo_svg(dark=False):
+ ink = WHITE if dark else INK
+ teal = "#2dd4bf" if dark else TEAL
+ wm, ww = wordmark()
+ gap = 22
+ scale = 1.0
+ mark = 56
+ total_w = mark + gap + ww + 4
+ # vertical: mark centred on the x-height band of the wordmark
+ top = T - 14 - 2.2 # i-dot top
+ bottom = B + 14 + 2.2 # descenders
+ h = bottom - top
+ my = (h - mark) / 2
+ tx = mark + gap + 2.2
+ ty = -top
+ s = (f'')
+ s = s.replace('class="dot"', f'stroke="{teal}"')
+ return s
+
+if __name__ == "__main__":
+ out = sys.argv[1]
+ open(f"{out}/logo.svg","w").write(logo_svg(False))
+ open(f"{out}/logo-dark.svg","w").write(logo_svg(True))
+ open(f"{out}/logo-mark.svg","w").write(mark_svg())