Skip to content

fix(core): store FigmaColor as hex instead of separate r/g/b fields - #52

Merged
dryor merged 2 commits into
mainfrom
feat/figma-color-hex
Aug 8, 2026
Merged

fix(core): store FigmaColor as hex instead of separate r/g/b fields#52
dryor merged 2 commits into
mainfrom
feat/figma-color-hex

Conversation

@dryor

@dryor dryor commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • FigmaColor (packages/core/src/figma/model.ts) is now { hex: string; a: number } instead of { r, g, b, a } — resolves the "Color is stored as {r, g, b}, not hex" entry in ADR-pending-decisions.md. A failing golden-fixture toEqual on a color now shows a readable "#F2F3F8" diff instead of separate r/g/b numbers.
  • Both color constructors (hexToColor in inspection-panel-reader.ts, parseRgbaColor in edit-mode-panel-reader.ts) and the one production consumer (markdown-writer.ts) updated accordingly. No r/g/b fields kept alongside hex — nothing read them individually except the formatter this change simplifies.
  • The 4 committed golden e2e fixtures were migrated mechanically (249 color objects) rather than re-fetched, since they require a live Figma session not available in this environment.
  • Breaking change to @figtools/core's public API — minor bump for both packages via changeset, matching this pre-1.0 repo's existing precedent.

Test plan

  • pnpm --filter @figtools/core test — 50/50 passing
  • pnpm --filter @figtools/cli test — 78/78 passing
  • pnpm typecheck — clean across the monorepo
  • pnpm test:e2e — requires a live figtools login session, not run here; the 2 e2e files that compare against the migrated fixtures should be re-run against real Figma before this ships

🤖 Generated with Claude Code

dryor and others added 2 commits August 8, 2026 12:08
Golden-fixture e2e comparisons showed unreadable r/g/b diffs on color
mismatches instead of a recognizable hex value. FigmaColor is now
{ hex, a } — no production code read r/g/b individually except the one
formatter now made trivial, so keeping them would have been redundant.
Resolves the "Color is stored as {r, g, b}, not hex" entry in
ADR-pending-decisions.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dryor
dryor merged commit b41e197 into main Aug 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant