games_app/brand/sync_svg_from_png.py
2026-10-12 19:18:13 +02:00

58 lines
2.0 KiB
Python

"""Make SVG mark identical to the master PNG by embedding it."""
from __future__ import annotations
import base64
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
BRAND = ROOT / "brand"
PNG = BRAND / "prediqo-mark.png"
def main() -> None:
b64 = base64.b64encode(PNG.read_bytes()).decode("ascii")
mark = (
'<svg xmlns="http://www.w3.org/2000/svg" '
'xmlns:xlink="http://www.w3.org/1999/xlink" '
'viewBox="0 0 128 128" role="img" aria-label="Tloto mark">\n'
" <!-- Identical to prediqo-mark.png (embedded master artwork) -->\n"
f' <image href="data:image/png;base64,{b64}" '
'x="0" y="0" width="128" height="128" '
'preserveAspectRatio="xMidYMid meet"/>\n'
"</svg>\n"
)
lockup = (
'<svg xmlns="http://www.w3.org/2000/svg" '
'xmlns:xlink="http://www.w3.org/1999/xlink" '
'viewBox="0 0 400 128" role="img" aria-label="Tloto">\n'
f' <image href="data:image/png;base64,{b64}" '
'x="0" y="0" width="128" height="128" '
'preserveAspectRatio="xMidYMid meet"/>\n'
' <text x="152" y="82" '
'font-family="Inter, Segoe UI, system-ui, sans-serif" '
'font-size="64" font-weight="800" fill="#F8FAFC" '
'letter-spacing="-1.5">TLOTO</text>\n'
"</svg>\n"
)
targets_mark = [
BRAND / "prediqo-mark.svg",
ROOT / "prediqo_web" / "public" / "brand" / "prediqo-mark.svg",
ROOT / "prediqo_web" / "public" / "favicon.svg",
ROOT / "prediqo_mobile" / "assets" / "brand" / "prediqo-mark.svg",
]
targets_lockup = [
BRAND / "prediqo-lockup.svg",
ROOT / "prediqo_web" / "public" / "brand" / "prediqo-lockup.svg",
]
for path in targets_mark:
path.write_text(mark, encoding="utf-8")
print(f"wrote {path}")
for path in targets_lockup:
path.write_text(lockup, encoding="utf-8")
print(f"wrote {path}")
if __name__ == "__main__":
main()