Repository Public
1#!/usr/bin/env python32# ORIX DJ3# File: Scripts/badges.py4# Description: Writes the README badges as local SVG files. Every value is typed here from a measured report5# (docs/reports, dist/release.json); nothing is fetched or computed at display time.6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9import os1011OUT = os.path.join(os.path.dirname(__file__), "..", "docs", "assets", "badges")12BADGES = [13 ("platform", "platform", "macOS 15+", "#0A84FF"),14 ("silicon", "architecture", "Apple Silicon (arm64)", "#5E5CE6"),15 ("swift", "Swift", "6, strict concurrency", "#F05138"),16 ("ui", "UI", "SwiftUI + AppKit + Metal", "#30B0C7"),17 ("audio", "audio", "Core Audio, own engine", "#BF5AF2"),18 ("script", "ORIX Script", "deterministic", "#FF375F"),19 ("offline", "mixing", "works offline", "#34C759"),20 ("accounts", "account", "none", "#34C759"),21 ("tests", "core tests", "241 passing", "#34C759"),22 ("uitests", "UI tests", "9 passing", "#34C759"),23 ("coverage", "core line coverage", "91.6 %", "#34C759"),24 ("version", "version", "1.0.0 (1)", "#0A84FF"),25 ("notarization", "notarization", "accepted, stapled", "#34C759"),26 ("release", "release", "1.0.0 published", "#34C759"),27 ("dmg-size", "DMG", "7.4 MB", "#8E8E93"),28 ("render", "render, 4 decks @ 256", "70.5 µs mean (1.3 %)", "#8E8E93"),29 ("sync", "sync error", "0.021 ms worst", "#8E8E93"),30 ("effects", "effects", "18", "#8E8E93"),31 ("presets", "automation presets", "24", "#8E8E93"),32 ("license", "license", "all rights reserved", "#8E8E93"),33]3435def width(text):36 return int(sum(4.2 if c in "il.,:;'| " else 7.4 if c.isupper() or c in "mw%" else 6.3 for c in text)) + 143738def svg(label, value, color):39 lw, vw = width(label), width(value)40 w = lw + vw41 return f'''<svg xmlns="http://www.w3.org/2000/svg" width="{w}" height="22" role="img" aria-label="{label}: {value}">42<title>{label}: {value}</title>43<clipPath id="r"><rect width="{w}" height="22" rx="5"/></clipPath>44<g clip-path="url(#r)"><rect width="{lw}" height="22" fill="#1C2030"/><rect x="{lw}" width="{vw}" height="22" fill="{color}"/></g>45<g fill="#fff" font-family="-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif" font-size="11" text-anchor="middle">46<text x="{lw/2}" y="15">{label}</text><text x="{lw + vw/2}" y="15" font-weight="600">{value}</text></g></svg>47'''4849os.makedirs(OUT, exist_ok=True)50for name, label, value, color in BADGES:51 with open(os.path.join(OUT, name + ".svg"), "w") as f:52 f.write(svg(label, value, color))53print(f"{len(BADGES)} badges written")54