Skip to content

fix(fork): sidebar brand mark is no longer blurry - #58

Merged
NoahHendrickson merged 2 commits into
customfrom
t3code/crisp-brand-mark
Aug 6, 2026
Merged

fix(fork): sidebar brand mark is no longer blurry#58
NoahHendrickson merged 2 commits into
customfrom
t3code/crisp-brand-mark

Conversation

@NoahHendrickson

@NoahHendrickson NoahHendrickson commented Aug 5, 2026

Copy link
Copy Markdown
Owner

The sidebar brand mark rendered blurry. Its art is a 23×23 pixel grid, but the asset shipped as a 24×24 PNG — 23 does not divide into 24, so the export resampled every cell with smoothing and baked the blur permanently into the file. Decoding the shipped PNG confirms it: 562 of its 576 pixels were not in the art's 9-colour palette, and the file held 136 distinct colours. image-rendering: pixelated made it worse rather than better, faithfully enlarging that mush into hard blocks on retina.

Rebuilt the mark as a vector from the Figma node — integer coordinates on a 0 0 23 23 viewBox with shape-rendering="crispEdges", so cells stay hard-edged at any size and DPR — and dropped the now-pointless image-rendering hack.

Left: before. Right: after. Both are the true rasterisation at 24 CSS px on a 2× display, magnified 9× so individual device pixels are visible.

brand mark before and after

One deliberate side effect: the old export had flattened Figma's #1E1E1E canvas into the bitmap (every pixel was opaque), which is the faint dark square around the mark. The vector is transparent, so it now composites onto the sidebar. The black is genuine art — the mark's outline — and is preserved.

Verification

Figma exports these rects under rotate()/matrix() transforms, so naive x/y parsing yields garbage; positions came from transforming each rect's corners. Three independent checks:

  • All 340 rects land exactly on the 23×23 grid, zero off-grid.
  • Sampling each cell centre of Figma's own 960px render: all 529 cells match exactly.
  • Round-tripping the emitted SVG reproduces all 529 cells with no overlaps.

typecheck clean, lint clean, forkSidebarChrome guards 16/16. The guard previously asserted the PNG was 24×24 — that assertion encoded the defect — so it now pins the vector invariants (23-unit viewBox, crispEdges, integer-only coordinates) instead.

Note: forkComposerShell.test.ts fails on this branch, but it fails identically on a clean custom (COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX is 620, guard expects 400). Pre-existing and unrelated.

Web-only. Mobile and desktop use separate upstream 1024px app icons, which are unaffected.

The evidence image above lives on the assets/brand-mark-crispness branch; delete it once this merges.

🤖 Generated with Claude Code — Claude Opus 5 (1M context)

Review round

Guard hardening landed in 926855d: the pixelated-hack ban now covers the component, and the integer-grid check asserts a coordinate count and bans transform=/<path> so it cannot pass vacuously. The DPR-1 center line (23 cells in a 24px slot) is accepted and documented in the lockup comment — drawing the art at 23px would center it on a half-pixel. The SVG staying over Vite's 4096-byte inline limit is deliberate: collapsing the rects into paths would blind the integer-grid guard, so the mark costs one cached request instead.

The mark's art is a 23x23 pixel grid, but the asset shipped as a 24x24
PNG. 23 does not divide into 24, so the export resampled every cell with
smoothing and baked the blur into the file: 562 of its 576 pixels were
not in the art's 9-colour palette, and it held 136 distinct colours.
`image-rendering: pixelated` then enlarged that mush into hard blocks on
retina rather than sharpening it. The export had also flattened Figma's
#1E1E1E canvas into the bitmap, which is the dark square behind the mark.

Rebuilt the mark as a vector from the Figma node: integer coordinates on
a 0 0 23 23 viewBox with shape-rendering="crispEdges", so cells stay
hard-edged at any size and DPR. Dropped the now-pointless image-rendering
hack, and the mark composites onto the sidebar instead of carrying a
backdrop. Figma exports these rects under rotate()/matrix() transforms,
so positions came from transforming each rect's corners; all 340 landed
exactly on the grid, and sampling every cell of Figma's own 960px render
matched all 529 cells.

The guard previously asserted the PNG was 24x24, which encoded the
defect. It now pins the vector invariants instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S labels Aug 5, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thermo-nuclear code quality review

No major structural issues found. Approval bar met.

This is a correctly layered asset fix: replace the defect-encoding 24×24 PNG (and the image-rendering:pixelated workaround that amplified it) with a 23-unit vector mark + crispEdges, retarget the fork guard to the real invariants, and update the manifest path. No spaghetti growth, no file-size pressure, no missed code-judo — the PR is the simplification.

Open in Web View Automation 

Sent by Cursor Automation: Thermo-nuclear PR review

@NoahHendrickson NoahHendrickson left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review

The diagnosis is right and the rebuild is sound. I independently verified the risky part rather than taking the PR body's word for it:

  • The vector matches the old bitmap. Decoded the removed PNG, reconstructed the new SVG's cell grid, box-resampled the vector 23→24 over #1e1e1e, and compared pixel-by-pixel: mean per-pixel error 12.6/441, max 30.4. Every alternative alignment (half-pixel offsets, 1:1 scale) scored 2–4× worse. That confirms the rects came out of Figma without mirroring, rotation, or an off-by-one — the failure mode most likely to survive the PR's own checks.
  • Grid integrity. 147 rects, 253 filled cells, 0 out-of-bounds, 0 overlaps, all-integer coordinates.
  • Plumbing. No svgr plugin in apps/web/vite.config.ts, so the default URL import is correct; Mime.getType (apps/server/src/http.ts:363) serves image/svg+xml; Electron CSP allows img-src 'self'; manifest entry updated; no dangling references to the PNG anywhere.
  • Transparency change. Net improvement — the old PNG carried a baked #1e1e1e square that was visible in the light theme. In the fork's dark theme the sidebar is exactly #1e1e1e, so the composite is pixel-identical to the flattened bitmap. Good call, and good that the PR body flags it.

Findings

# Where What
1 SidebarChrome.tsx:99 23-unit grid in a 24px box — at DPR 1 the center row and column render 2px where every other cell is 1px. Verified in headless Chromium.
2 forkSidebarChrome.test.ts:185 toContain("size-6 shrink-0") still passes if [image-rendering:pixelated] comes back.
3 forkSidebarChrome.test.ts:201 Integer-coordinate loop passes vacuously on zero matches, and ignores transform=/<path>.
4 sidebar-brand-mark.svg 6386 bytes exceeds Vite's 4096 inline limit; the 1093-byte PNG was inlined, so the mark now costs a separate request.

Details inline.

Recommendation: ship it, with #2 and #3 fixed first. The guard weakening is the one I'd hold on — this is a fork guard whose entire job is stopping this defect from returning, and both issues let it go green while the defect is back. They're a few lines each.

#1 is real and worth a decision, but it isn't a reason to block: a crisp mark with one heavy center line is still much better than what's on custom today. Either take the 23px-in-a-24px-slot fix or drop the "any size or DPR" claim from the code comment. #4 is a nit.

Also confirming the PR body's note: forkComposerShell.test.ts does fail identically on a clean custom (COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX is 620, guard expects 400). Pre-existing and unrelated to this change.


Generated by Claude Code

Comment thread apps/web/src/components/sidebar/SidebarChrome.tsx
Comment thread apps/web/src/__fork_guards__/forkSidebarChrome.test.ts
Comment thread apps/web/src/__fork_guards__/forkSidebarChrome.test.ts Outdated
Comment thread apps/web/src/custom/assets/sidebar-brand-mark.svg
The pixelated-hack check now covers the component, where the hack lived,
not just the asset. The integer-grid loop can no longer pass vacuously:
it asserts a coordinate count and pins the geometry to plain rect
attributes, so an svgo pass or re-export routing geometry through
transforms or path data fails instead of hiding. The lockup comment
stops claiming cell uniformity at every DPR — the 23-into-24 center
line at DPR 1 is a recorded trade, not an oversight.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@NoahHendrickson
NoahHendrickson merged commit 2cde13c into custom Aug 6, 2026
10 checks passed
@NoahHendrickson
NoahHendrickson deleted the t3code/crisp-brand-mark branch August 6, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant