Skip to content

Make the favicon a background-free, theme-aware logo - #2

Merged
GoatInAHat merged 1 commit into
mainfrom
claude/favicon-theme-aware-logo-so3uu8
Aug 24, 2026
Merged

GoatInAHat merged 1 commit into
mainfrom
claude/favicon-theme-aware-logo-so3uu8

Conversation

@GoatInAHat

@GoatInAHat GoatInAHat commented Aug 24, 2026 •

Copy link
Copy Markdown
Owner

Drops the black plate behind the mark and makes the icon follow the viewer's colour scheme.

What changed

  • public/favicon.svg — the source of truth. Background <rect> removed; the mark is re-fitted to a square canvas (viewBox="11.442 11.237 44.088 44.088", the path's exact bbox squared with 4% padding) so it reads edge-to-edge instead of sitting inside a badge. Path data is untouched. A <style> block fills it #000, switching to #fff under @media (prefers-color-scheme: dark).

  • index.html — the 96px PNG link is split into a light/dark pair selected by media. The light one is declared last, so a browser that ignores media on icon links lands on the black mark (the safe default for light fallback surfaces) rather than an invisible white one.

  • Rasters — each size rendered from the SVG at its own resolution rather than downscaled from one bitmap, all RGBA with a transparent background:

    file size(s) mark
    favicon.ico 16 / 32 / 48 black
    favicon-96x96.png 96 black
    favicon-96x96-dark.png 96 white
    apple-touch-icon.png 180 white

    The apple-touch icon uses the white mark because iOS composites transparent home-screen icons onto black.

  • AGENTS.md — the public/ row now says the SVG is the source and the rasters are rendered from it.

Icon payload: 17.8 kB → 6.2 kB.

Verification

  • npm run lint, npm run build, npm run check:force (816 assertions), npm run check:density (139500 assertions), git diff --check, pre-commit run --all-files — all pass.
  • Rendered PNGs decoded pixel-by-pixel: correct dimensions, RGBA with alpha, antialiased edges, glyph coverage consistent across sizes (~23%), and the light/dark pair identical in geometry with only the fill differing.
  • favicon.ico re-parsed: 3 entries, each a valid 32-bit RGBA PNG matching its directory dimensions, no trailing bytes.
  • The prefers-color-scheme switch confirmed in Chromium by loading favicon.svg as an image — black under the default scheme, white with the dark preference forced, same 2113 opaque pixels either way.
  • Rendered a light/dark contact sheet at 16/32/48/96/180 against tab-strip backgrounds; the mark stays legible down to 16px in both schemes.
  • npm run preview serves every icon at HTTP 200 with the right content type, and the page renders unchanged.

No generation script is committed — the SVG is the source, and any SVG rasteriser reproduces the set.

Drop the black plate from the favicon and re-fit the mark to a square
canvas with 4% padding, so the logo reads edge-to-edge instead of sitting
inside a badge. `favicon.svg` carries a `prefers-color-scheme` rule, so it
draws black on light UI and white on dark.

Rasters can't carry that rule, so ship both: `favicon-96x96.png` (black)
and `favicon-96x96-dark.png` (white), selected by `media` on their icon
links, with the light one last so browsers that ignore `media` land on it.
Every raster is rendered from the SVG at its own size — 16/32/48 inside
the `.ico`, 96 for the PNGs, 180 for the apple-touch icon — rather than
downscaled, and all are RGBA with a transparent background. The
apple-touch icon uses the white mark because iOS composites transparent
home-screen icons onto black.

Icon payload drops from 17.8 kB to 6.2 kB.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HSpEGpoGdyewcAX6VzG6W1
@GoatInAHat
GoatInAHat marked this pull request as ready for review August 24, 2026 22:01
@GoatInAHat
GoatInAHat merged commit fcce7d0 into main Aug 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants