Skip to content

feat(profile): show the banner as vectors so its text is sharp at any size - #80

Merged
kingchenc merged 1 commit into
mainfrom
profile-banner-vector
Sep 24, 2026
Merged

kingchenc merged 1 commit into
mainfrom
profile-banner-vector

Conversation

@kingchenc

Copy link
Copy Markdown
Contributor

The profile README scales the banner to its column, about 900 CSS px, so the 3840 px WebP was resampled by the browser and its 12-15 px labels came out soft on every screen. A larger raster does not fix that: it only makes the downscale larger.

gen-banner.mjs now also writes profile/wickra-banner.svg, the same picture with every glyph converted to a path by resvg. The browser rasterises it at the display's own resolution, so the text is as sharp as the screen allows at every width and zoom, and no font has to be installed on the viewer's machine (an <img> SVG cannot load fonts, and live text would break the measured monospace layout). The rounded corners become a clip path. Font, sizes, layout and aspect ratio are unchanged.

  • resvg writes the gradient of the wordmark's "ra" <tspan> as a copy with an empty id, referenced as url(#), which renders the word black. The generator names it and stops if more than one such copy ever appears.
  • Rendered back, the vector banner is pixel-identical to the source SVG (no pixel differs by more than 40 of 255 outside the clipped corners); checked in Chrome as well, gradient and corners included.
  • The WebP stays as the raster copy for places that take no SVG, now 7680x3840 and lossless (417 KB).
  • The README, the ?v= cache-buster that indicator-count.yml bumps, and banner.yml's commit step follow the new file. BANNER_FONT_DIR lets a machine without DejaVu Sans Mono render the banner locally; CI keeps using the runner's copy and re-renders on merge.

… size

The profile README scales the banner to its column, about 900 CSS px, so the
3840 px WebP was resampled by the browser and its 12-15 px labels came out
soft on every screen; more source pixels only mean a larger downscale.
gen-banner.mjs now also writes profile/wickra-banner.svg: the same picture
with every glyph converted to a path by resvg, so the browser rasterises it
at the display's own resolution and no font has to be present on the
viewer's machine. The rounded corners become a clip path.

resvg writes the gradient of the wordmark's "ra" tspan as a copy with an
empty id; the generator names it and stops if more than one such copy ever
appears. The vector banner renders pixel-identical to the source SVG.

The WebP stays as the raster copy, now 7680x3840 and lossless. The README,
the cache-buster the indicator-count workflow bumps, and banner.yml's commit
step follow the new file. BANNER_FONT_DIR lets a machine without DejaVu Sans
Mono render the banner locally.
@kingchenc
kingchenc merged commit 14add30 into main Sep 24, 2026
3 checks passed
@kingchenc
kingchenc deleted the profile-banner-vector branch September 24, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant