Commit 4dc703b26d
Verified · cmc
Layout: unified · split
README.nfo +1
| @@ -21,6 +21,7 @@ STRUCTURE | |||
| 21 | templates/ tera templates | 21 | templates/ tera templates |
| 22 | sass/main.scss styles, compiled to main.css | 22 | sass/main.scss styles, compiled to main.css |
| 23 | static/ assets, favicon.svg, CNAME | 23 | static/ assets, favicon.svg, CNAME |
| 24 | assets/ logo sources; build.sh regenerates the icons | ||
| 24 | 25 | ||
| 25 | DEPLOY | 26 | DEPLOY |
| 26 | pushing to main builds and publishes to github pages via | 27 | pushing to main builds and publishes to github pages via |
assets/build.sh added +20
| @@ -0,0 +1,20 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | # Regenerate the raster icons in static/ from the sources here. | ||
| 3 | # macOS only: qlmanage rasterizes the svg, sips crops it. | ||
| 4 | set -euo pipefail | ||
| 5 | cd "$(dirname "$0")" | ||
| 6 | |||
| 7 | out=../static | ||
| 8 | tmp=$(mktemp -d) | ||
| 9 | trap 'rm -rf "$tmp"' EXIT | ||
| 10 | |||
| 11 | # qlmanage always renders square, so og.svg is authored 1200x1200 with the | ||
| 12 | # 630-tall band centred, then cropped back to size afterwards. | ||
| 13 | qlmanage -t -s 1200 -o "$tmp" og.svg >/dev/null | ||
| 14 | sips -c 630 1200 "$tmp/og.svg.png" >/dev/null | ||
| 15 | cp "$tmp/og.svg.png" "$out/og.png" | ||
| 16 | |||
| 17 | qlmanage -t -s 180 -o "$tmp" touch.svg >/dev/null | ||
| 18 | cp "$tmp/touch.svg.png" "$out/apple-touch-icon.png" | ||
| 19 | |||
| 20 | echo "wrote $out/og.png and $out/apple-touch-icon.png" | ||
assets/mark.py added +62
| @@ -0,0 +1,62 @@ | |||
| 1 | #!/usr/bin/env python3 | ||
| 2 | """Render the krz frame mark to RGBA PNG at exact integer pixel boundaries.""" | ||
| 3 | import struct, zlib, sys | ||
| 4 | |||
| 5 | GRID = 32 | ||
| 6 | # (x, y, w, h) in grid units | ||
| 7 | FRAME = [(4, 4, 24, 4), (4, 24, 24, 4), (4, 8, 4, 16), (24, 8, 4, 16)] | ||
| 8 | BLOCK = (12, 12, 8, 8) | ||
| 9 | |||
| 10 | INKS = { | ||
| 11 | "dark": ("#17171a", "#2f6bd6"), # for light backgrounds | ||
| 12 | "light": ("#f1f1ef", "#6f9dff"), # for dark backgrounds | ||
| 13 | } | ||
| 14 | |||
| 15 | |||
| 16 | def rgba(hexstr): | ||
| 17 | h = hexstr.lstrip("#") | ||
| 18 | return (int(h[0:2], 16), int(h[2:4], 16), int(h[4:6], 16), 255) | ||
| 19 | |||
| 20 | |||
| 21 | def chunk(tag, data): | ||
| 22 | return (struct.pack(">I", len(data)) + tag + data | ||
| 23 | + struct.pack(">I", zlib.crc32(tag + data) & 0xFFFFFFFF)) | ||
| 24 | |||
| 25 | |||
| 26 | def render(size, fg_hex, ac_hex, path): | ||
| 27 | if size % GRID: | ||
| 28 | sys.exit(f"size {size} must be a multiple of {GRID}") | ||
| 29 | s = size // GRID | ||
| 30 | fg, ac = rgba(fg_hex), rgba(ac_hex) | ||
| 31 | # transparent canvas | ||
| 32 | px = bytearray(size * size * 4) | ||
| 33 | |||
| 34 | def fill(rect, color): | ||
| 35 | x, y, w, h = (v * s for v in rect) | ||
| 36 | row = bytes(color) * w | ||
| 37 | for yy in range(y, y + h): | ||
| 38 | off = (yy * size + x) * 4 | ||
| 39 | px[off:off + w * 4] = row | ||
| 40 | |||
| 41 | for r in FRAME: | ||
| 42 | fill(r, fg) | ||
| 43 | fill(BLOCK, ac) | ||
| 44 | |||
| 45 | # filter byte 0 per scanline | ||
| 46 | raw = b"".join(b"\x00" + bytes(px[r * size * 4:(r + 1) * size * 4]) | ||
| 47 | for r in range(size)) | ||
| 48 | png = (b"\x89PNG\r\n\x1a\n" | ||
| 49 | + chunk(b"IHDR", struct.pack(">IIBBBBB", size, size, 8, 6, 0, 0, 0)) | ||
| 50 | + chunk(b"IDAT", zlib.compress(raw, 9)) | ||
| 51 | + chunk(b"IEND", b"")) | ||
| 52 | with open(path, "wb") as f: | ||
| 53 | f.write(png) | ||
| 54 | return len(png) | ||
| 55 | |||
| 56 | |||
| 57 | if __name__ == "__main__": | ||
| 58 | for name, (fg, ac) in INKS.items(): | ||
| 59 | for size in (1024, 512): | ||
| 60 | p = f"krz-mark-{size}-{name}.png" | ||
| 61 | n = render(size, fg, ac, p) | ||
| 62 | print(f"{p:28} {size}x{size} {n:,}b") | ||
assets/og.svg added +21
| @@ -0,0 +1,21 @@ | |||
| 1 | <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="1200" viewBox="0 0 1200 1200"> | ||
| 2 | <rect width="1200" height="1200" fill="#fbfbf9"/> | ||
| 3 | <!-- content band: 1200x630, centered vertically for a post-render crop --> | ||
| 4 | <g transform="translate(0,285)"> | ||
| 5 | <rect x="48" y="48" width="1104" height="534" fill="none" stroke="#d9d8d2" stroke-width="2"/> | ||
| 6 | |||
| 7 | <!-- mark, 120x120 at (112,225) --> | ||
| 8 | <g transform="translate(112,225) scale(3.75)"> | ||
| 9 | <g fill="#17171a"> | ||
| 10 | <rect x="4" y="4" width="24" height="4"/> | ||
| 11 | <rect x="4" y="24" width="24" height="4"/> | ||
| 12 | <rect x="4" y="8" width="4" height="16"/> | ||
| 13 | <rect x="24" y="8" width="4" height="16"/> | ||
| 14 | </g> | ||
| 15 | <rect x="12" y="12" width="8" height="8" fill="#2f6bd6"/> | ||
| 16 | </g> | ||
| 17 | |||
| 18 | <text x="272" y="314" font-family="SF Mono, Menlo, monospace" font-size="84" font-weight="700" fill="#17171a" letter-spacing="-2">krz.sh</text> | ||
| 19 | <text x="112" y="403" font-family="SF Mono, Menlo, monospace" font-size="24" fill="#5c5c5f">Small, durable software focused on utility, privacy, and control.</text> | ||
| 20 | </g> | ||
| 21 | </svg> | ||
assets/touch.svg added +12
| @@ -0,0 +1,12 @@ | |||
| 1 | <svg xmlns="http://www.w3.org/2000/svg" width="180" height="180" viewBox="0 0 32 32"> | ||
| 2 | <rect width="32" height="32" fill="#fbfbf9"/> | ||
| 3 | <g transform="translate(3.2,3.2) scale(0.8)"> | ||
| 4 | <g fill="#17171a"> | ||
| 5 | <rect x="4" y="4" width="24" height="4"/> | ||
| 6 | <rect x="4" y="24" width="24" height="4"/> | ||
| 7 | <rect x="4" y="8" width="4" height="16"/> | ||
| 8 | <rect x="24" y="8" width="4" height="16"/> | ||
| 9 | </g> | ||
| 10 | <rect x="12" y="12" width="8" height="8" fill="#2f6bd6"/> | ||
| 11 | </g> | ||
| 12 | </svg> | ||