testsAndMisc/python_pkg/app_icons
Krzysztof kuhy Rudnicki 1d7271f023 Phase 2: enforce the 250-line cap and stop pushing red
Two pre-commit hooks and one pre-push extension, plus the _glyph_art split
that had to land first — the cap gate cannot be wired while any file is over
it, and the lyricanki note-ascender glyph had taken _glyph_art.py to 253.

file-length-cap runs check_file_length.sh --all repo-wide rather than on
staged files, so a file that grows past the cap in some other commit is still
caught. Proven to block, not assumed: with a deliberate 261-line file staged
the hook exits 1 and names it; with the file removed it passes.

ci-baseline-green is the user's option (a): refuse to build on a main that is
already red. It fails closed on a definitively failing baseline and warns-and-
passes on anything it cannot determine — offline, no gh, unauthenticated, no
settled runs — each call capped at 5s. Blocking every commit on network
reachability buys nothing when (b) is the real per-change guarantee.
CI_GREEN_SKIP=1 is the escape for a fix-forward commit. python-tests.yml is
excluded on purpose: it is path-filtered, so a shell-only commit never
triggers it and its "latest run" would produce false reds.

This hook already earned its place. Run against a red main earlier in this
session it refused with "Shell tests (failure)", which is how the broken
SETUP_SOURCES was found instead of being pushed over.

ci_mirror gains the shell-tests workflow's side-effect-free half — every
lib/tests/run_all.sh plus the workflow's own test list, the user's option (b).
That list is parsed out of shell-tests.yml rather than copied: a hardcoded
duplicate drifts the moment someone adds a test, and a mirror that quietly
checks less than CI is worse than no mirror because it reports safe. The
Arch-container half stays unmirrored — it wants root and an Arch userland.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3PzGc75gBcdxP3PkHXGcV
2026-08-21 16:41:31 +02:00
..
tests Move billsplit Flutter app into the monorepo 2026-08-03 12:22:22 +02:00
__init__.py Add shared launcher-icon generator for the Flutter apps 2026-07-19 16:55:48 +02:00
__main__.py Add shared launcher-icon generator for the Flutter apps 2026-07-19 16:55:48 +02:00
_glyph_art_more.py Phase 2: enforce the 250-line cap and stop pushing red 2026-08-21 16:41:31 +02:00
_glyph_art.py Phase 2: enforce the 250-line cap and stop pushing red 2026-08-21 16:41:31 +02:00
apps.py Phase 2: enforce the 250-line cap and stop pushing red 2026-08-21 16:41:31 +02:00
cli.py Add shared launcher-icon generator for the Flutter apps 2026-07-19 16:55:48 +02:00
generate.py app_icons: auto-sync pubspec.yaml's adaptive_icon_background 2026-07-21 21:38:22 +02:00
glyphs.py Phase 2: enforce the 250-line cap and stop pushing red 2026-08-21 16:41:31 +02:00
preview.py Add shared launcher-icon generator for the Flutter apps 2026-07-19 16:55:48 +02:00
README.md app_icons: warm-tint the shared icon family palette 2026-07-21 21:20:41 +02:00
render.py Add shared launcher-icon generator for the Flutter apps 2026-07-19 16:55:48 +02:00
style.py app_icons: warm-tint the shared icon family palette 2026-07-21 21:20:41 +02:00

app_icons — shared launcher icons for the Flutter apps

One icon family across every Flutter/Dart app: a charcoal #211D1B field with a single glyph in the shared unified-design-system accent (#B8862E), drawn at one stroke weight and optically centred so a row of them lines up.

Commands

# what is registered
PYTHONPATH=~/testsAndMisc python3 -m python_pkg.app_icons list

# contact sheet for visual review: full size / circle-masked / 48dp
PYTHONPATH=~/testsAndMisc python3 -m python_pkg.app_icons preview -o /tmp/sheet.png

# write assets into every app repo and rebuild the Android mipmaps
PYTHONPATH=~/testsAndMisc python3 -m python_pkg.app_icons generate --android

# one app, plus the hicolor PNGs for a Linux desktop target
PYTHONPATH=~/testsAndMisc python3 -m python_pkg.app_icons \
    generate --app todo --android --linux-out ~/todo/linux/icons

What gets written

Per app, into <repo>/assets/icon/:

Layer Purpose
icon Charcoal field + glyph. Legacy square launcher icon and Linux icon.
icon_foreground Glyph only, transparent. Adaptive-icon foreground layer.
icon_monochrome Glyph only, white. Android 13+ themed icons.

Both an .svg source and a 1024px .png are written for each, so a build never needs rsvg-convert. flutter_launcher_icons then turns the PNGs into the density buckets and mipmap-anydpi-v26/ic_launcher.xml.

Design constraints that bite

  • Negative space ≥ half the stroke weight. Strokes closer than that merge into a solid blob at launcher size. A fork whose tines sat exactly one stroke width apart rendered as a tulip.
  • Ink must stay inside the 560px safe box. Android masks adaptive icons to roughly the inner 66% of the canvas. generate warns when a glyph overflows.
  • Stroked outlines can read wrong. A stroked three-tine fork reads as a trident; a filled fork-and-knife pair reads as cutlery. Prefer a filled silhouette when the outline is ambiguous.
  • Glyph positioning inside the fragment is irrelevant — render.centre_offset measures the rendered ink and recentres it. Only the extents matter.

Adding an app

See the app-icon skill (~/.claude/skills/app-icon/SKILL.md) for the full procedure. In short: add a glyph to glyphs.py, register the app in apps.py, wire flutter_launcher_icons into its pubspec.yaml, generate, review the contact sheet, then verify on the phone.

Tests

cd ~/testsAndMisc
python3 -m pytest python_pkg/app_icons --cov=python_pkg.app_icons \
    --cov-report=term-missing

External tools (rsvg-convert, magick, dart) are mocked; the suite needs none of them installed.