mirror of
https://github.com/zanwei/design-dna.git
synced 2026-09-14 19:59:56 +08:00
a8a08d45ee
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.