Skip to content

refactor(templates): migrate CV/cover-letter icons from PNG to recolorable SVG#212

Merged
DemchaAV merged 3 commits into
developfrom
feat/cv-svg-icons
Jun 18, 2026
Merged

refactor(templates): migrate CV/cover-letter icons from PNG to recolorable SVG#212
DemchaAV merged 3 commits into
developfrom
feat/cv-svg-icons

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

Why

The bundled CV template icons were raster PNGs — ~717 KB under templates/cv (the sidebar-portrait portrait.png alone was 431 KB) — which bloats the published jar and can't be recoloured per template.

What changed

  • New internal SvgGlyph (cv/v2/widgets) loads a bundled SVG, flattens its filled layers into one ShapeOutline (dropping near-white backing rects), and the presets render it inline + recoloured via rich.shape(glyph.outline(size), ICON_COLOR, …). Colour is a per-template code knob — one bundled glyph recolours for every template and the icons stay crisp at any zoom.
  • Migrated the contact/social glyphs in all four icon CV presets (v2 + deprecated-v1: MintEditorial, MonogramSidebar, SidebarPortrait, TimelineMinimal) and the paired TimelineMinimalLetter cover letter to SVG + SvgGlyph; deleted the 29 PNGs. The mint expertise badge keeps its stroked look via SvgIcon.node, recoloured in-file.
  • Sidebar-portrait avatar is now a swappable SVG (portrait.svg) via SvgIcon.node — users can later replace it with their own image. Its CSS-<style> colours were inlined as presentation attributes (the SVG reader doesn't read <style>), translucency baked into #rrggbbaa.
  • IconTextRow now takes the SvgGlyph + colour; the dead raster overload and the WidgetSmokeTest path loading the now-deleted phone.png were removed.

Result: templates/cv assets ~717 KB → ~133 KB. No public API change; CV/cover-letter layout unchanged.

Verification

  • ./mvnw clean verify -pl .1395 tests, 0 failures.
  • Visual baselines refreshed for the new glyphs (8 files); the sidebar-portrait layout snapshot updated for the vector avatar. Other templates pass within the existing cross-platform tolerance, untouched.
  • The four CV example PDFs + the timeline cover letter render correctly — icons recoloured per template; globe / house / location-pin (with hole) / avatar all correct.

Note

Independent of #211 (fonts split) but both edit CHANGELOG.md v1.8.0 — whichever merges second may need a one-line CHANGELOG conflict resolution.

DemchaAV added 3 commits June 18, 2026 12:19
…rable SVG

Why: the bundled CV template icons were raster PNGs — ~717 KB under
templates/cv (the sidebar-portrait portrait.png alone was 431 KB) — which
bloats the published jar and cannot be recoloured per template.

What:
- New internal SvgGlyph helper (cv/v2/widgets) loads a bundled SVG, flattens
  its filled layers into one ShapeOutline (dropping near-white backing rects),
  and exposes it for inline rendering via rich.shape(outline, colour). Colour
  becomes a per-template code knob — one bundled glyph recolours for every
  template and the icons stay crisp at any zoom.
- Migrated the contact / social glyphs in all four icon CV presets (v2 and the
  deprecated v1: MintEditorial, MonogramSidebar, SidebarPortrait,
  TimelineMinimal) and the paired TimelineMinimalLetter cover letter to SVG +
  SvgGlyph; deleted the 29 PNGs. The mint expertise badge keeps its stroked
  look via SvgIcon.node, recoloured in-file to the mint accent.
- Sidebar-portrait avatar is now an SVG rendered via SvgIcon.node — a swappable
  placeholder users can later replace with their own image. Its CSS-<style>
  colours were inlined as presentation attributes (the SVG reader does not read
  <style>), with translucency baked into #rrggbbaa.
- IconTextRow now takes the SvgGlyph + colour; the dead raster overload and the
  WidgetSmokeTest path that loaded the now-deleted phone.png were removed.

Result: templates/cv assets drop ~717 KB -> ~133 KB. No public API change and
the CV / cover-letter layout is unchanged. Visual baselines were refreshed for
the new glyphs and the sidebar-portrait layout snapshot updated for the vector
avatar.

Verification: ./mvnw clean verify -pl . green (1395 tests); the four CV example
PDFs and the timeline cover letter render correctly — icons recoloured per
template, and the globe / house / location-pin / avatar all render right.
…lity

The PNG->SVG migration removed the public
IconTextRow.render(DocumentImageData, ...) overload, which japicmp flagged as
METHOD_REMOVED against the v1.7.0 baseline — IconTextRow is public API, so
external template authors could call it. Restored the overload (the bundled
presets use the recolorable SvgGlyph overload; the raster one stays for
callers with their own raster icons), keeping the change source- and
binary-compatible.
@DemchaAV DemchaAV merged commit c00ecc8 into develop Jun 18, 2026
11 checks passed
@DemchaAV DemchaAV deleted the feat/cv-svg-icons branch June 18, 2026 11:42
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.

1 participant