Files
arbpulse_github/scripts/gen-icons.ps1
T
Mauricio Barragan 5d84df3e25 feat(pwa): installable PWA + responsive mobile dashboard
- Add Web App Manifest + ArbPulse icons (192/512/maskable/apple-touch) under
  web/public/; no service worker (real-time honesty: never serve stale data).
- Add mobile/install metadata to index.html (theme-color, viewport-fit=cover,
  apple-mobile-web-app-*, manifest + apple-touch-icon links).
- Responsive layout: PriceMatrix stacked per-venue cards below sm, StatsBar
  reflow, ~44px touch targets in Controls/ConfigPanel, safe-area top inset.
- scripts/gen-icons.ps1 derives icon sizes from the master (no new deps).
- openspec: add-pwa-mobile change (proposal/design/specs/tasks).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 15:21:13 -06:00

45 lines
1.9 KiB
PowerShell

# One-off ArbPulse PWA icon generator.
# Resizes the AI-generated master icon into the sizes referenced by the
# Web App Manifest and index.html. Uses only Windows System.Drawing (no deps).
param(
[string]$Master = (Join-Path $PSScriptRoot "arbpulse-icon-master.png"),
[string]$OutDir = (Join-Path $PSScriptRoot "..\web\public")
)
Add-Type -AssemblyName System.Drawing
$bg = [System.Drawing.ColorTranslator]::FromHtml("#0a0e14")
function Save-Resized {
param([System.Drawing.Image]$Src, [int]$Size, [string]$Path, [double]$Scale = 1.0)
$bmp = New-Object System.Drawing.Bitmap($Size, $Size)
$g = [System.Drawing.Graphics]::FromImage($bmp)
$g.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
$g.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::HighQuality
$g.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality
$g.Clear($bg)
$target = [int]([math]::Round($Size * $Scale))
$offset = [int]([math]::Round(($Size - $target) / 2))
$rect = New-Object System.Drawing.Rectangle($offset, $offset, $target, $target)
$g.DrawImage($Src, $rect)
$g.Dispose()
$bmp.Save($Path, [System.Drawing.Imaging.ImageFormat]::Png)
$bmp.Dispose()
Write-Output "wrote $Path ($Size x $Size, scale $Scale)"
}
$src = [System.Drawing.Image]::FromFile($Master)
Save-Resized -Src $src -Size 192 -Path (Join-Path $OutDir "icon-192.png")
Save-Resized -Src $src -Size 512 -Path (Join-Path $OutDir "icon-512.png")
Save-Resized -Src $src -Size 180 -Path (Join-Path $OutDir "apple-touch-icon.png")
# Maskable: full-bleed on the master's own background. The glyph's built-in
# padding already keeps it inside the ~80% safe zone, and full-bleed avoids a
# visible seam from mismatched flat padding vs. the master's subtle glow.
Save-Resized -Src $src -Size 512 -Path (Join-Path $OutDir "icon-maskable-512.png") -Scale 1.0
$src.Dispose()