Skip to main content

Module icongen

Module icongen 

Source
Expand description

Seeded app-icon generator (docs/icons.md): one u64 seed → a deterministic layered SVG master (day:background / day:foreground / day:monochrome, the contract day icon consumes), designed to read well through every downstream form — iOS squircle, Android adaptive + themed monochrome, plain PNG.

The compositions encode the published icon-design guidance rather than free-form noise:

  • One or two focal points in simple geometry — icons are judged at small sizes, so a single dominant motif with at most a couple of supporting accents (Apple HIG).
  • Safe-zone placement — primary content stays inside the central region so the iOS squircle and Android circle masks never clip it; the backdrop alone bleeds full-canvas.
  • A limited, harmonious palette — a background tone plus at most two accent hues, drawn from the classic color-harmony schemes (analogous, complementary, split-complementary, triadic) with saturation/lightness held to bands that keep figure-ground contrast high on both dark and light backdrops.
  • Flat or subtly gradient backgrounds — a gentle vertical two-stop gradient of one hue (the HIG’s “subtle top-to-bottom gradient adds depth without looking dated”).
  • Balance — compositions are either symmetric (centered, rotational) or golden-section asymmetric with a small counterweight, the two classical routes to visual equilibrium.

Determinism is part of the contract: day new seeds from the app id so the same id always regenerates the same icon, and day icon --generate --seed N reproduces exactly.

Functions§

generate
Generate the master SVG for seed. Deterministic: the same seed always yields the same bytes (the day new app-id contract).
seed_from_str
Hash an arbitrary string (an app id, a pet name) into a seed — FNV-1a 64, hand-rolled so the mapping is stable across Rust versions (std’s hashers are randomly keyed).