"""Generates the Pipelines mark as SVG variants and the Android vector drawables."""
import sys, os
OUT = sys.argv[1]
def graph(color=True, mono='#FFFFFF'):
c = (lambda v: v) if color else (lambda v: mono)
return f'''
'''
def svg(scale=1.12, rounded=True, background=True, color=True):
bg = ''
if background:
rx = ' rx="14"' if rounded else ''
bg = f'''
'''
t = f'translate(32 32) scale({scale}) translate(-32 -32)'
return f'''
'''
variants = {
'rounded.svg': svg(), # favicon, web icons, legacy Android
'square.svg': svg(rounded=False), # iOS (the OS masks corners)
'maskable.svg': svg(scale=0.92, rounded=False), # PWA maskable: inside the 80% safe circle
}
for name, body in variants.items():
open(os.path.join(OUT, name), 'w').write(body)
# Android vectors share one path set. The 64-unit graph is placed in the 108dp
# adaptive canvas inside the 66dp safe zone (scale 66/64*0.92 about the centre).
def vector(color=True, size=108, scale=None, comment=''):
s = scale if scale is not None else (66 / 64) * 1.12
tx = size / 2 - 32 * s
def col(v): return v if color else '#FFFFFFFF'
def stroke(d, colr, w=3.6):
return f''' '''
def dot(cx, cy, r, colr):
d = f'M{cx - r},{cy}a{r},{r} 0,1 0,{2 * r},0a{r},{r} 0,1 0,{-2 * r},0'
return f''' '''
ring = 'M49,32m-4.3,0a4.3,4.3 0,1 0,8.6,0a4.3,4.3 0,1 0,-8.6,0'
return f'''
{stroke('M17,32 C24,32 24,21 31,21', '#FF8FA8FF')}
{stroke('M17,32 C24,32 24,43 31,43', '#FF8FA8FF')}
{stroke('M33,21 C39.5,21 39.5,32 43.6,32', '#FF5FD3B8')}
{stroke('M33,43 C39.5,43 39.5,32 43.6,32', '#FFC59BFF')}
{dot(15, 32, 6, '#FF8FA8FF')}
{dot(32, 21, 5.2, '#FF5FD3B8')}
{dot(32, 43, 5.2, '#FFC59BFF')}
{stroke(ring, '#FF7BE39B', 3.4)}
'''
open(os.path.join(OUT, 'ic_launcher_foreground.xml'), 'w').write(vector(comment='Adaptive icon foreground: the graph in the 66dp safe zone.'))
open(os.path.join(OUT, 'ic_launcher_monochrome.xml'), 'w').write(vector(color=False, comment='Themed (monochrome) icon: the same graph in one colour.'))
# Notification small icon: 24dp, white, the graph filling most of the canvas.
open(os.path.join(OUT, 'ic_stat_pipelines.xml'), 'w').write(vector(color=False, size=24, scale=24 / 64 * 1.12, comment='Status bar icon (white; Android tints it).'))
print('ok')