29 lines
1.4 KiB
Bash
Executable file
29 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
# Copies the logos every demo opens and closes with from their sources in media/ into demos/art/:
|
|
# the Singe dragon, turned to face left, and lettering for the opening card, the lettering turned near-white to stand on
|
|
# black, and Kangaroo Punch's logo made for black, uncompressed, for the closing one. The demos draw
|
|
# them from the SVG at the screen's resolution (demos/kit.lua, K.vector).
|
|
set -euo pipefail
|
|
|
|
REPO=$(cd "$(dirname "$0")/.." && pwd)
|
|
ART="$REPO/demos/art"
|
|
LETTERING="#f2f2f2"
|
|
|
|
mkdir -p "$ART"
|
|
# The dragon turned to face left, as on Singe's own logo: everything in the drawing mirrored about the
|
|
# middle of its view box.
|
|
python3 - "$REPO/media/Dragon.svg" "$ART/dragon.svg" <<'PY'
|
|
import re, sys
|
|
svg = open(sys.argv[1]).read()
|
|
x, y, w, h = (float(v) for v in re.search(r'viewBox="([^"]+)"', svg).group(1).split())
|
|
opening = re.search(r'<svg[^>]*>', svg)
|
|
svg = svg[:opening.end()] + '<g transform="translate(%g 0) scale(-1 1)">' % (2 * x + w) + svg[opening.end():]
|
|
svg = svg.replace('</svg>', '</g></svg>')
|
|
open(sys.argv[2], "w").write(svg)
|
|
PY
|
|
sed "s/fill=\"#000\"/fill=\"$LETTERING\"/" "$REPO/media/SingeText.svg" > "$ART/singeText.svg"
|
|
if ! grep -q "fill=\"$LETTERING\"" "$ART/singeText.svg"; then
|
|
echo "SingeText.svg no longer has fill=\"#000\" to recolour" >&2
|
|
exit 1
|
|
fi
|
|
zcat "$REPO/media/Kangaroo Punch Logo with Text on Black.svgz" > "$ART/kangarooPunch.svg"
|