fix(core): store FigmaColor as hex instead of separate r/g/b fields - #52
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inADR-pending-decisions.md. A failing golden-fixturetoEqualon a color now shows a readable"#F2F3F8"diff instead of separater/g/bnumbers.hexToColorininspection-panel-reader.ts,parseRgbaColorinedit-mode-panel-reader.ts) and the one production consumer (markdown-writer.ts) updated accordingly. Nor/g/bfields kept alongsidehex— nothing read them individually except the formatter this change simplifies.@figtools/core's public API —minorbump for both packages via changeset, matching this pre-1.0 repo's existing precedent.Test plan
pnpm --filter @figtools/core test— 50/50 passingpnpm --filter @figtools/cli test— 78/78 passingpnpm typecheck— clean across the monorepopnpm test:e2e— requires a livefigtools loginsession, 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