#!/usr/bin/env python3 """Writes case-*/index.html and case-*/manifest.webmanifest from CASES.""" import json from pathlib import Path ROOT = Path(__file__).resolve().parent.parent BASE = "/i-566319139" CASES = [ { "dir": "case-maskable", "title": "Maskable icon, declared 144x144, served 144x120", "short": "NonSquare Maskable", "theme": "#c62828", "icons": [ ("icon-square-192.png", "image/png", "192x192", "any"), ("icon-maskable-144x120.png", "image/png", "144x144", "maskable"), ], "served": ("icon-maskable-144x120.png", 144, 120), "before": "Desktop stores no maskable icon at all (the bitmap is dropped as " "non-square). The Android install dialog already looks right.", "after": "Desktop stores a padded 144x144 maskable icon with the clock " "still round.", }, { "dir": "case-any", "title": "\"any\" icon, declared 160x160, served 160x120", "short": "NonSquare Any", "theme": "#1565c0", "icons": [ ("icon-square-192.png", "image/png", "192x192", "any"), ("icon-any-160x120.png", "image/png", "160x160", "any"), ], "served": ("icon-any-160x120.png", 160, 120), "before": "Desktop silently drops the blue icon and only keeps the green " "fallback. The Android install dialog picks the blue icon and " "stretches it: the clock becomes an oval.", "after": "Desktop stores the blue icon padded to 160x160; the Android " "install dialog shows a round clock.", }, { "dir": "case-svg", "title": "SVG with a 2:1 viewBox, declared 192x192", "short": "NonSquare SVG", "theme": "#7b1fa2", "icons": [("icon-wide.svg", "image/svg+xml", "192x192", "any")], "served": ("icon-wide.svg", 200, 100), "before": "Desktop requests the SVG without a size, gets a wide raster, " "drops it as non-square and installs a generated letter icon.", "after": "Desktop requests the SVG at 192x192, so it rasterizes square with " "the purple card centered.", }, { "dir": "case-webapk", "title": "Only icon, declared 512x512, served 512x384", "short": "NonSquare WebAPK", "theme": "#1e5ac8", "icons": [("icon-any-512x384.png", "image/png", "512x512", "any")], "served": ("icon-any-512x384.png", 512, 384), "before": "Desktop has no usable icon and installs a generated letter icon. " "The Android install dialog squashes the clock into a tall oval. " "The minted WebAPK itself is fine: the WebAPK server keeps the " "512x384 bytes and Android fits them without distortion.", "after": "Desktop stores a padded 512x512 icon and the Android install " "dialog shows a round clock. The minted WebAPK bytes still " "need a separate follow-up.", }, ] PAGE = """
Install this page as an app and look at the icon. A round clock means the icon was padded to a square; an oval means it was stretched; a letter means it was thrown away.
| Manifest icon | type | sizes | purpose |
|---|
| before | with CL 8545991 |
|---|---|
| {before} | {after} |
Or use the browser menu: "Install page as app" / "Add to home screen".
{src}