diff --git a/README.md b/README.md index e33667f..eaac9e5 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ constellation. | `avatar/org-avatar.png` (500px), `@2x` (1000px) | GitHub org profile picture | | `avatar/mark.svg`, `mark.png`, `mark@2x.png` | Transparent mark for READMEs and docs | | `social/.png` (1280×640) | GitHub social preview for each repo | +| `app-icon/ic_launcher.svg`, `play-store.png` (512px) | Android app launcher icon and Play Store icon | ## Palette @@ -39,6 +40,15 @@ Neutrals: background `#0a0f1c`, panel `#121a2e`, text `#e8f0ff`, muted `#7f8bab`. Type: Sauce Code Pro, the [Nerd Fonts](https://www.nerdfonts.com/) build of [Source Code Pro](https://github.com/adobe-fonts/source-code-pro). +## App icon + +D-Modem app icon + +The front of an RJ11 jack, its outline striped in the Rainbow Book colours +like the mark, with the white carrier inside. It is drawn on Android's +108-unit adaptive icon canvas; the app's `ic_launcher_foreground` and +`ic_launcher_monochrome` vector drawables follow `tools/app_icon.py`. + ## Previews | | | @@ -65,4 +75,5 @@ intended; the SVGs name it as their font, so viewers without it fall back to another monospace font. python3 tools/gen.py + python3 tools/app_icon.py node tools/render.js diff --git a/app-icon/ic_launcher.png b/app-icon/ic_launcher.png new file mode 100644 index 0000000..6b51afa Binary files /dev/null and b/app-icon/ic_launcher.png differ diff --git a/app-icon/ic_launcher.svg b/app-icon/ic_launcher.svg new file mode 100644 index 0000000..a717793 --- /dev/null +++ b/app-icon/ic_launcher.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/app-icon/play-store.png b/app-icon/play-store.png new file mode 100644 index 0000000..69a85de Binary files /dev/null and b/app-icon/play-store.png differ diff --git a/app-icon/play-store.svg b/app-icon/play-store.svg new file mode 100644 index 0000000..b04ec19 --- /dev/null +++ b/app-icon/play-store.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/tools/app_icon.py b/tools/app_icon.py new file mode 100644 index 0000000..6958b43 --- /dev/null +++ b/tools/app_icon.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +"""The app's launcher icon: an RJ11 jack striped in the Rainbow Book colours, the white carrier inside. +Drawn on Android's 108-unit adaptive icon canvas (launchers show the middle 72, keep art within 21..87).""" +import os +from gen import ROOT, BOOKS, BG, INK, wave_path + +X, Y, W, H = 34, 34, 40, 32 # the jack opening; the latch notch hangs below it + + +def jack_d(): + nx, nh, cx = W * 0.4, H * 0.3, X + W / 2 + return f"M{X},{Y} H{X + W} V{Y + H} H{cx + nx / 2} V{Y + H + nh} H{cx - nx / 2} V{Y + H} H{X} Z" + + +def icon(size=432, view="0 0 108 108"): + stops = "".join(f'' + for i, (_, _, c) in enumerate(BOOKS)) + return f''' +{stops} + + + +''' + + +if __name__ == "__main__": + os.makedirs(os.path.join(ROOT, "app-icon"), exist_ok=True) + with open(os.path.join(ROOT, "app-icon", "ic_launcher.svg"), "w") as f: + f.write(icon() + "\n") + # Play Store listing icon: 512px of the 72 units a launcher shows (Play applies its own mask) + with open(os.path.join(ROOT, "app-icon", "play-store.svg"), "w") as f: + f.write(icon(512, "18 18 72 72") + "\n") diff --git a/tools/render.js b/tools/render.js index 24d06b0..26860dd 100644 --- a/tools/render.js +++ b/tools/render.js @@ -1,4 +1,4 @@ -// Renders avatar/*.svg and social/*.svg to PNGs next to them, using Playwright's Chromium. +// Renders avatar/*.svg, social/*.svg and app-icon/*.svg to PNGs next to them, using Playwright's Chromium. // The avatar also gets a 2x (1000px) export. Needs Sauce Code Pro (Nerd Font Mono) installed for the text. const { chromium } = require('playwright'); const fs = require('fs'), path = require('path'); @@ -6,7 +6,7 @@ const root = path.join(__dirname, '..'); (async () => { const browser = await chromium.launch(); - for (const dir of ['avatar', 'social']) { + for (const dir of ['avatar', 'social', 'app-icon']) { for (const f of fs.readdirSync(path.join(root, dir)).filter(f => f.endsWith('.svg'))) { const svg = fs.readFileSync(path.join(root, dir, f), 'utf8'); const [, w, h] = svg.match(/width="(\d+)" height="(\d+)"/);