[object Object]

← back to Designer Wallcoverings

enrich: near-solid products trust merchant color name (deep 'Red' oxblood reads Red, not blocked); hue/lightness-tolerant thresholds; mismatch log only on genuine conflicts

49c7f068be83cbf685acb143a32446ce7c5ff8d7 · 2026-07-07 10:43:35 -0700 · Steve

Files touched

Diff

commit 49c7f068be83cbf685acb143a32446ce7c5ff8d7
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue Jul 7 10:43:35 2026 -0700

    enrich: near-solid products trust merchant color name (deep 'Red' oxblood reads Red, not blocked); hue/lightness-tolerant thresholds; mismatch log only on genuine conflicts
---
 shopify/scripts/enrich-color-details-local.py | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/shopify/scripts/enrich-color-details-local.py b/shopify/scripts/enrich-color-details-local.py
index 63d07fca..72ae36fb 100644
--- a/shopify/scripts/enrich-color-details-local.py
+++ b/shopify/scripts/enrich-color-details-local.py
@@ -276,17 +276,26 @@ def anchor_marketed(colors, p):
     def dist(hexstr):
         h = hexstr.lstrip('#'); r, g, b = int(h[0:2], 16), int(h[2:4], 16), int(h[4:6], 16)
         return (r - kr[0]) ** 2 + (g - kr[1]) ** 2 + (b - kr[2]) ** 2
+
+    def flag_review():
+        append_jsonl(REVIEW_LOG, {'id': p.get('id'), 'title': p.get('title'),
+                                  'marketed': canon, 'palette': [c['name'] for c in colors]})
+
     if colors[0].get('pct', 0) >= 58:
+        # Near-solid: the product IS one color and the merchant named it — trust the
+        # merchant's name for the dominant (deep 'Red' oxblood should read Red, not
+        # get blocked). Only LOG if the image is wildly off (still anchor).
         idx = 0
+        if min(dist(c['hex']) for c in colors) > 120 ** 2:
+            flag_review()
     else:
+        # Multi-color: anchor the marketed color to its matching accent ONLY if that
+        # color is actually present; otherwise the marketed name conflicts with the
+        # image (e.g. 'White on Silver' → dark palette) — log, keep swatches truthful.
         idx = min(range(len(colors)), key=lambda i: dist(colors[i]['hex']))
-    # Honesty flag: if the marketed color is nowhere near ANY extracted swatch, the
-    # vendor's colorway name conflicts with the actual image — log for merchant review
-    # (do NOT silently override; the swatches stay truthful to the image).
-    if min(dist(c['hex']) for c in colors) > 95 ** 2:
-        append_jsonl(REVIEW_LOG, {'id': p.get('id'), 'title': p.get('title'),
-                                  'marketed': canon, 'palette': [c['name'] for c in colors]})
-        return colors
+        if dist(colors[idx]['hex']) > 110 ** 2:
+            flag_review()
+            return colors
     if all(c['name'] != canon for j, c in enumerate(colors) if j != idx):
         colors[idx]['name'] = canon
     return colors

← d8edd9bf contrarian pass 2 fixes: neutral cool-grey lexicon (Mist/Fog  ·  back to Designer Wallcoverings  ·  auto-save: 2026-07-07T11:00:06 (6 files) — pending-approval/ 1b0b9a6b →