Skip to content

v0.3.0-alpha — Visual DNA v3: palette matching

Pre-release
Pre-release

Choose a tag to compare

@Shepdesign Shepdesign released this 21 May 22:27
· 57 commits to main since this release

hooked on facets v0.3.0-alpha — Visual DNA v3: palette matching

Third alpha. Visual DNA grows up: each product now indexes a top-N color palette instead of a single dominant color, and queries match across the whole palette. A product with a 10% gold accent on a navy background can be found by a "gold" search — the navy doesn't have to be its only personality.

📦 Download hooked-on-facets-0.3.0-alpha.zip · 📝 Wiki: Visual DNA · 🗺️ Roadmap


🎨 What's new: Visual DNA v3 — palette matching

The headline behavior: a query for an accent color now ranks the product carrying that accent ahead of products that don't have it at all — even if the accent isn't the product's dominant color. Verified end-to-end:

Query  {gold #ffd700}  →  top results:
   1. blue-with-gold-accent     dE=0.00   ← gold is in its palette
   2. yellow                    dE=17.44
   3. amber                     dE=31.72
   4. lime                      dE=48.97

v2 would have ranked solid yellow first. v3 picks up the accent.

🔧 Under the hood

  • Extractorextract_palette_from_post() returns up to N entries (default 5), each {L, a, b, weight} ordered by weight desc. Filters out buckets below 5% of opaque pixels; drops near-white/black unless that's all that's left.
  • Indexer — writes one _visual_dna_lab row per palette entry. The bucket weight stores in the existing facet_numeric column — no schema migration. v2 → v3 is a code-only upgrade; just reindex and the new rows take over.
  • REST /visual-dna — accepts either hex (single, back-compat) or hexes (array). SQL ranks via MIN(LEAST(…)) over the cross product (query palette × product palette), so a product matches if any of its palette colors is close to any of the query colors.
  • Frontend — image inputs (drop file, paste URL) extract a top-5 palette client-side and send hexes. Eyedrop stays single-hex. UI renders the extracted palette as a row of small color dots in the result panel.
  • Verification (bin/verify-visual-dna.{php,sh}) — extended with:
    • Section 1: Dominant LAB matches expected (v2 contract preserved) — 25/25 ΔE=0.00
    • Section 2: Every expected palette color present in the extracted palette within ΔE < 2 — 25/25
    • Section 3: Single-hex query ranking — red / blue / green all ✅
    • Section 4: Multi-hex / accent-color ranking — {gold} query returns blue-with-gold-accent first

🆙 Upgrade from v0.2.0-alpha

  1. Replace the plugin files (drop-in — schema unchanged).
  2. Trigger a reindex so products gain palette rows in place of single-color rows: admin button or wp eval 'new HookedOnFacets\Indexer()->reindex_all();'.
  3. No config changes needed — existing Visual DNA facets automatically use the new endpoint behavior.

🚧 Remaining limitations

  • Color only. Pattern, shape, texture still aren't factors. A striped red-and-blue shirt and a solid violet shirt may land near each other in LAB space.
  • No weight at query time. A product with 40% red ranks the same on a red query as a product with 5% red. Weight-aware ranking is a tunable v4 option.
  • Index time cost. Each reindex'd product with a featured image pays ~30–80 ms for the extraction + (palette-size) INSERTs. On a 100k-product catalog plan for the initial extraction; subsequent saves only re-extract the affected product.

Still in the box

Everything from v0.2.0-alpha continues to work: ten public facet displays (Checkbox, Radio, Dropdown, Toggle, Hierarchy, Range, Date Range, Search, Color Swatch, Swipe Deck), the 2D Slider and Ask view facets, the React 18 admin SPA, the vanilla JS public runtime, BYOK Anthropic key for Ask, the v2 Visual DNA single-color path as graceful fallback when no LAB rows are indexed yet.

Feedback

Issues, PRs, "this didn't work for me" reports — all welcome.