Download source/scripts/generate_brand.py from CladeTeam/ouroboros: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/spaces/CladeTeam/ouroboros/resolve/main/source/scripts/generate_brand.py
- Command line
-
hf download hf://spaces/CladeTeam/ouroboros/source/scripts/generate_brand.py
-
curl -L -o generate_brand.py https://huggingface.co/spaces/CladeTeam/ouroboros/resolve/main/source/scripts/generate_brand.py
1.99 kB
| """Generate the continuous red/blue infinity identity as editable SVG assets.""" | |
| import json | |
| import math | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| OUT = ROOT / 'public' / 'brand' | |
| OUT.mkdir(exist_ok=True) | |
| def point(t): | |
| return 160 + 130 * math.sin(t), 96 + 59 * math.sin(2 * t) | |
| def tangent(t): | |
| return 130 * math.cos(t), 118 * math.cos(2 * t) | |
| # Cubic segments retain a smooth tangent through both loops and the crossover. | |
| step=math.pi/4 | |
| parts=['M160 96'] | |
| for i in range(8): | |
| a,b=i*step,(i+1)*step | |
| p,q=point(a),point(b) | |
| u,v=tangent(a),tangent(b) | |
| parts.append('C'+ ' '.join(f'{n:.3f}' for n in (p[0]+u[0]*step/3,p[1]+u[1]*step/3,q[0]-v[0]*step/3,q[1]-v[1]*step/3,q[0],q[1]))) | |
| path=''.join(parts)+'Z' | |
| (ROOT/'src'/'brandGeometry.json').write_text(json.dumps({'path':path},separators=(',', ':'))+'\n') | |
| body=f'<defs><linearGradient id="infinity-color" x1="25" y1="96" x2="295" y2="96" gradientUnits="userSpaceOnUse"><stop stop-color="#367dc5"/><stop offset=".5" stop-color="#9473a6"/><stop offset="1" stop-color="#df6254"/></linearGradient></defs><path d="{path}" fill="none" stroke="url(#infinity-color)" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"/>' | |
| (OUT/'ouroboros-mark.svg').write_text(f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 192" role="img" aria-labelledby="title"><title id="title">Ouroboros — a continuous blue-to-red infinity loop</title>{body}</svg>\n') | |
| (OUT/'ouroboros-avatar.svg').write_text(f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><rect width="512" height="512" rx="112" fill="#f8f9fa"/><g transform="translate(16 112) scale(1.5)">{body}</g></svg>\n') | |
| (ROOT/'public'/'favicon.svg').write_text(f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="#f8f9fa"/><g transform="translate(1.6 13.76) scale(.19)">{body}</g></svg>\n') | |
| print('Generated continuous infinity mark, avatar, favicon and shared React geometry.') | |