Files
pipelines/app/tool/app_icon/make_icon.py
T
alan 4503febb07 App icon: the Pipelines tab glyph in white
Replaces the coloured graph with the Pipelines tab's own glyph (Material
account_tree, outlined, taken from the MaterialIcons font) in white on the
dark background, across Android, iOS and web.
2026-11-01 20:03:26 +00:00

60 lines
2.6 KiB
Python

"""Generates the Pipelines app icon: the Pipelines tab glyph (Material
account_tree, outlined) in white on the dark app background.
python3 make_icon.py OUTDIR
Writes rounded.svg (web, legacy Android), square.svg (iOS), maskable.svg (PWA)
and the Android vectors: adaptive foreground, themed monochrome and the
status-bar icon.
"""
import os
import sys
OUT = sys.argv[1]
# Material Icons "account_tree" (outlined), 24-unit grid.
# Extracted from Flutter's MaterialIcons-Regular.otf (U+EE36).
GLYPH = 'M21.984 11.016V3H15V6H9V3H2.016V11.016H9V8.016H11.016V18H15V21H21.984V12.984H15V15.984H12.984V8.016H15V11.016H21.984ZM6.984 9H3.984V5.016H6.984V9ZM17.016 15H20.016V18.984H17.016V15ZM17.016 5.016H20.016V9H17.016V5.016Z'
WHITE = '#FFFFFF'
def svg(glyph_size=34.0, rounded=True):
rx = ' rx="14"' if rounded else ''
s = glyph_size / 24
t = 32 - 12 * s
return f'''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Pipelines">
<defs><linearGradient id="bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#1B1B24"/><stop offset="1" stop-color="#0E0E12"/></linearGradient></defs>
<rect width="64" height="64"{rx} fill="url(#bg)"/>
<path transform="translate({t:.3f} {t:.3f}) scale({s:.4f})" d="{GLYPH}" fill="{WHITE}" fill-rule="evenodd"/>
</svg>
'''
def vector(size, glyph_size, comment):
s = glyph_size / 24
t = size / 2 - 12 * s
return f'''<?xml version="1.0" encoding="utf-8"?>
<!-- {comment} The Pipelines tab glyph (Material account_tree, outlined). -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="{size}dp"
android:height="{size}dp"
android:viewportWidth="{size}"
android:viewportHeight="{size}">
<group android:scaleX="{s:.4f}" android:scaleY="{s:.4f}" android:translateX="{t:.3f}" android:translateY="{t:.3f}">
<path android:pathData="{GLYPH}" android:fillColor="#FFFFFFFF" android:fillType="evenOdd"/>
</group>
</vector>
'''
for name, body in {
'rounded.svg': svg(),
'square.svg': svg(rounded=False),
'maskable.svg': svg(glyph_size=28, rounded=False),
}.items():
open(os.path.join(OUT, name), 'w').write(body)
# Adaptive canvas 108dp: the glyph at ~46dp sits well inside the 66dp safe zone.
open(os.path.join(OUT, 'ic_launcher_foreground.xml'), 'w').write(vector(108, 46, 'Adaptive icon foreground.'))
open(os.path.join(OUT, 'ic_launcher_monochrome.xml'), 'w').write(vector(108, 46, 'Themed (monochrome) icon.'))
open(os.path.join(OUT, 'ic_stat_pipelines.xml'), 'w').write(vector(24, 22, 'Status bar icon (Android tints it).'))
print('ok')