SPB Git

Repository Public

build.py 3.5 KB 75 lines python

1# =============================================================================2#                  SP BOUCHER | SOFTWARE & RESEARCH3#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# Project          : SPB Git for iOS and iPadOS7# File             : design/app-icon/build.py8# Module           : Design9# Repository       : https://git.spboucher.ai/spbgit-ios10# Project Website  : Not specified11# Created          : 2026-12-0212# Last Modified    : 2026-12-0213#14# Author           : Simon-Pierre Boucher15# Position         : Professor of Finance16# Institution      : Université du Québec en Outaouais (UQO)17# Organization     : SP Boucher18# Website          : https://spboucher.ai19# Git              : https://git.spboucher.ai20#21# Preferred Contact: contact@spboucher.ai22# Development      : dev@spboucher.ai23# Support          : support@spboucher.ai24# Security/Admin   : admin@spboucher.ai25#26# Copyright (c) 202627# Simon-Pierre Boucher28# All rights reserved where applicable. This file is governed by the29# applicable project license, copyright notices and relevant law.30# Existing third-party rights and notices remain unaffected.31#32# License          : None specified (no license file in this repository)33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# Builds the SPB Git app icon variants (default, dark, tinted) from one parametric SVG with rsvg-convert.42# usage: python3 design/app-icon/build.py   (writes PNG files next to this script)43import subprocess, pathlib44here = pathlib.Path(__file__).parent4546def svg(bg_top, bg_bottom, trunk, branch, grid, transparent=False):47    bg = "" if transparent else f'''<rect width="1024" height="1024" fill="url(#bg)"/>48  <g stroke="{grid}" stroke-width="2">49    {''.join(f'<line x1="{x}" y1="0" x2="{x}" y2="1024"/>' for x in range(128, 1024, 128))}50    {''.join(f'<line x1="0" y1="{y}" x2="1024" y2="{y}"/>' for y in range(128, 1024, 128))}51  </g>'''52    hole = "none" if transparent else "url(#bg)"53    return f'''<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">54  <defs><linearGradient id="bg" x1="0" y1="0" x2="0" y2="1024" gradientUnits="userSpaceOnUse">55    <stop offset="0" stop-color="{bg_top}"/><stop offset="1" stop-color="{bg_bottom}"/></linearGradient></defs>56  {bg}57  <g transform="translate(-15 0)"><g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="60">58    <path d="M384 338 V686" stroke="{trunk}"/>59    <path d="M384 610 C384 496 640 548 640 420" stroke="{branch}"/>60    <circle cx="384" cy="256" r="82" stroke="{trunk}" fill="{hole}"/>61    <circle cx="384" cy="768" r="82" stroke="{trunk}" fill="{hole}"/>62  </g>63  <circle cx="640" cy="330" r="112" fill="{branch}"/></g>64</svg>'''6566variants = {67    "icon-default": svg("#1B2029", "#0B0D11", "#F3F4F1", "#2E7BFF", "#FFFFFF0A"),68    "icon-dark": svg("#000000", "#000000", "#F3F4F1", "#3D88FF", "#FFFFFF00", transparent=True),69    "icon-tinted": svg("#000000", "#000000", "#FFFFFF", "#9A9A9A", "#FFFFFF00", transparent=True),70}71for name, text in variants.items():72    (here / f"{name}.svg").write_text(text)73    subprocess.run(["rsvg-convert", "-w", "1024", "-h", "1024", str(here / f"{name}.svg"), "-o", str(here / f"{name}.png")], check=True)74    print(name)75
Files main
Menu

Theme