mkicons

command
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Command mkicons renders the LAN Sheriff badge to PNG at the sizes browsers and phones actually ask for.

Why this exists rather than a build-time SVG converter

An SVG favicon covers modern browsers, and it is what the dashboard links first. Two things still need raster: Safari before 16, and the iOS home screen, which will not accept an SVG at all and falls back to a screenshot of the page if no PNG is offered.

Every obvious way to produce those PNGs was worse. A rasteriser like librsvg or ImageMagick is a build dependency for four small files. Driving a headless browser is a build dependency with a browser inside it. Committing PNGs somebody generated by hand once is how icons drift from the logo they are supposed to be.

The badge is a star, five lines and six circles. That is arithmetic, and the standard library can do arithmetic, so this draws it directly with 4x supersampling for the edges. No dependencies, runs anywhere Go runs, and the output is identical every time.

**The geometry is duplicated from web/public/badge.svg and web/src/badge.tsx on purpose, and that is the one thing to watch.** Three copies of the same shape can drift. They are all derived from the constants below; if the badge changes, change it here and re-run, and the test in this package compares the two coordinate sets so a drift fails rather than ships.

go run ./scripts/mkicons

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL