feat(capture): extract gradient washes, glass panels, and nav CTAs#1879
Conversation
The design-style extractor now captures a site's signature color grounds and materials that a flat background-color misses: - Capture gradient background-image + backdrop-filter on buttons/cards/nav. - backgrounds[]: dominant gradient / mesh washes ranked by on-screen area (includes ::before/::after glow orbs), chroma-weighted so a small vivid brand wash outranks a large neutral scrim. - glass[]: frosted-glass panels (backdrop-filter blur) with their raw translucent fill, border, radius, shadow — ranked by area. - nav CTA capture: keep filled buttons inside <nav> (a page's primary "Sign up" / "Start for free" CTA that the old nav-drop lost), including gradient-filled CTAs whose background-COLOR is transparent. - Dedup keys for buttons/cards now include gradient + glass so a gradient/frosted variant is not collapsed into its flat sibling. - Fix: a fully-transparent fill rgba(...,0) now reports "transparent" instead of #000000 — the old bug turned every transparent wrapper into a phantom black button/card. types: ComponentStyle gains backgroundImage/backdropFilter; DesignStyles gains backgrounds[] and glass[]. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7e1fc3d to
aafdc62
Compare
miga-heygen
left a comment
There was a problem hiding this comment.
Review — Extract gradient washes, glass panels, and nav CTAs
Verdict: LGTM with nits ✅
Well-structured extension to the design-style extractor. Gradient background washes ranked by chroma-weighted area, frosted-glass panels via backdrop-filter + raw translucent fill, and nav CTAs that were previously discarded. Also fixes a real bug where rgba(...,0) transparent fills were reported as #000000. Type-safe (optional fields on existing interfaces), backward compatible.
Nits
-
isFilledEltransparent-detection regex —/rgba?\([^)]*,\s*0\s*\)/matches the blue channel ofrgb(r, g, 0)as a zero-alpha. Chromium returnsrgb(0, 0, 0)(notrgba) for solid black, so a black nav CTA button would be falsely excluded. Fix: usergba\((require thea) since onlyrgba()carries an explicit alpha. Low-impact in practice (solid-black CTAs are rare, gradient fallback catches them), but a correctness gap worth tightening. -
Button dedup key omits
backdropFilter— Cards includebackdropFilterin their dedup key, but buttons don't. A frosted-glass button variant would collapse with its non-frosted sibling. Likely intentional (frosted buttons are very rare), but the asymmetry is worth noting. -
rgbToHexcomment slightly overstates — Comment says "both comma and modern slash syntax" but the regex still requires commas between R, G, B. It supportsrgba(r, g, b / a)but not fully space-separatedrgb(r g b / a). Functionally correct sincegetComputedStylereturns comma-separated values — just the comment is slightly misleading.
Ponytail
Gradient section queries up to 400 elements with pseudo-element inspection and chroma weighting — justified complexity for the domain. Glass section is similarly proportionate. gradientChroma is a clean bespoke function with no stdlib alternative. Lean already. Ship.
2 files changed, +138 / −8
miguel-heygen
left a comment
There was a problem hiding this comment.
Verified at aafdc629. This is scoped to the design-style extractor output: gradients are captured as explicit background washes, glass panels preserve the raw translucent fill/backdrop blur, and filled nav CTAs are retained without re-admitting plain nav links. The new fields are optional in DesignStyles, and the current downstream path just serializes the JSON, so this stays backward-compatible.
Miga's nits are valid but non-blocking: the rgba? transparent check can be tightened, button dedupe omits backdropFilter, and the rgbToHex comment overstates slash-syntax support. None of those change the ship call for this additive extractor improvement.
Checks are green.
Verdict: APPROVE
Reasoning: Additive capture metadata with bounded sampling, optional types, and no failing checks or runtime consumer breakage.
— Magi
What
Extends the
hyperframes capturedesign-style extractor to capture a site's signature color grounds and materials — the layers a flatbackground-colormisses. These are what let a downstreamframe.mdreproduce a brand's gradients, frosted glass, and its real primary CTA.Changes
backgroundImage(gradient) andbackdropFilter.backgrounds[]— dominant gradient / mesh washes ranked by on-screen area (includes::before/::afterglow orbs), chroma-weighted so a small vivid brand wash outranks a large neutral scrim.glass[]— frosted-glass panels (backdrop-filterblur) with their raw translucent fill, border, radius, shadow, ranked by area.<nav>(a page's primary "Sign up" / "Start for free" CTA that the old nav-drop discarded), including gradient-filled CTAs whosebackground-coloris transparent.rgba(...,0)now reports"transparent"instead of#000000— the old behavior turned every transparent wrapper into a phantom black button/card.Types:
ComponentStylegainsbackgroundImage/backdropFilter;DesignStylesgainsbackgrounds[]andglass[](both optional — backward compatible).Testing
bun run build— passes (full ordered build)bunx oxlint+bunx oxfmt --checkon both files — cleanbunx vitest run src/capture/— 48/48 pass🤖 Generated with Claude Code