Skip to content

feat: icon — SVG→dither compiler (Bayer entrance, controlled progress)#17

Open
DloomPlz wants to merge 1 commit into
Boring-Software-Inc:mainfrom
DloomPlz:feat/icon
Open

feat: icon — SVG→dither compiler (Bayer entrance, controlled progress)#17
DloomPlz wants to merge 1 commit into
Boring-Software-Inc:mainfrom
DloomPlz:feat/icon

Conversation

@DloomPlz

Copy link
Copy Markdown
Contributor

Summary

Adds <DitherIcon> — an SVG→dither compiler. Give it any SVG icon component (a lucide icon, a logo): it serializes the SVG, rasterizes it at cell resolution on an offscreen canvas, reads the alpha channel, and re-emits it through the ordered-dither texture the rest of the kit is made of.

<DitherIcon icon={Wallet} color="blue" size={40} />
<DitherIcon icon={Wallet} size={40} cell={2} strokeWidth={2.5} />  // chunky pixel-art
<DitherIcon icon={Wallet} progress={scrollProgress} />             // scroll-linked reveal
  • Bayer materialize entrance — cells sweep in with the same matrix the texture dithers with (same recipe as the avatar).
  • Controlled progress (0–1) — overrides the entrance for scroll-linked reveals; an in-flight entrance yields the moment progress arrives.
  • Density caps at 0.85 so solid fills keep the texture (a saturated cell map would just be a flat icon).
  • Colours are irrelevant to compilation — currentColor is pinned before serializing; only coverage matters, so anti-aliased edges dither out naturally.
  • Standalone item like avatar/button/gradient (pixel.ts + palette.ts only). Canvas backing is sized once per compiled model, never per frame. Honors prefers-reduced-motion; decorative by default (ariaLabel={null} → aria-hidden), role="img" when labeled.

Details

  • alphaToDensity exported + unit-tested; mount tests pin the labeled/decorative aria contract with a dependency-free inline SVG (happy-dom safe — sampling no-ops without a real canvas).
  • Registry item + barrel export + COMPONENTS.md sections; r/ JSON regenerated.
  • Suite: 30/30.

@tripwire-dev

tripwire-dev Bot commented Jul 13, 2026

Copy link
Copy Markdown

passed — nothing tripped. good to merge.

View on Tripwire

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