3 Commits

Author SHA1 Message Date
zanwei.guo 593e39bc9e Fix deterministic color measurement and verification (#3) 2026-08-28 09:58:49 +08:00
minjishang4566 a8a08d45ee Add deterministic color measurement and a verify loop
Perceived colors drift toward familiar palette defaults (a brand pink
like #f476b8 reads as #ec4899, dE ~17; a near-black #16151b reads as
pure #000000). This adds two optional zero-config scripts and wires
them into the skill:

- scripts/measure-colors.mjs: deterministic k-means (farthest-point
  init) over the actual pixels with perceptual dE merging of
  anti-aliasing/JPEG noise; outputs exact hexes with coverage and
  background/text/accent roles for design_system.color
- scripts/verify.mjs: re-measures the generated implementation and
  reports per-color dE + coverage drift with PASS/FAIL thresholds
  (mean dE <= 5, max dE <= 20, drift <= 0.35), so the agent can
  self-correct instead of asking the user to judge by eye
- scripts/color-math.mjs: shared sRGB->Lab / dE76 math
- SKILL.md: Analyze uses measured hexes verbatim when the reference is
  an image; Generate ends with a verify step
- references/schema.md: optional measured_palette field for traceability
- README: Deterministic Measurement section with a before/after example
  (docs/example-deterministic-measurement.png): rebuilding bun.sh's
  hero from perceived style fails verify at mean dE 9.54, while the
  measured rebuild passes at mean dE 0.87

No API keys; the only dependency is sharp (Node >=18.17), installed
inside scripts/ and gitignored. package-lock.json is ignored to avoid
lockfile churn in a skill repo. Translated READMEs are not updated
here; happy to sync them during review.
2026-08-11 20:01:40 -07:00
zanwei.guo ae0c91dddf chore: initialize design-dna skill repo with bilingual README
Made-with: Cursor
2026-03-23 18:09:34 +08:00