Repository navigation
Import Figma composed colors with authored opacity - #883
Open
heddendorp wants to merge 2 commits into
Open
heddendorp wants to merge 2 commits into
heddendorp wants to merge 2 commits into
Conversation
Co-authored-by: Codex <noreply@openai.com>
🦋 Changeset detectedLatest commit: 0054310 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
🟡 Changes recommended
Reused mode IDs across collections can bypass the documented mode-name matching and default fallback, producing incorrect color or opacity values.
1 open issue
What changed in this PR
Adds support for importing Figma composed colors as literal sRGB values, addressing undefined color components while preserving ordinary aliases.
Changes:
- Resolves numeric or aliased opacity, replacing the source alpha.
- Includes hidden nested dependencies and detects cyclic references.
- Adds synthetic regression tests and a patch changeset.
| File | Description |
|---|---|
packages/cli/test/figma-composed-colors.test.ts |
Tests composed values, opacity, dependencies, modes, and errors. |
packages/cli/src/import/figma/variables.ts |
Integrates composed-color resolution and nested dependency discovery. |
packages/cli/src/import/figma/composed-color.ts |
Implements alias traversal, mode selection, and composed-color validation. |
.changeset/figma-composed-colors.md |
Documents the importer fix for a patch release. |
Review effort: Balanced
Co-authored-by: Codex <noreply@openai.com>
| throw new Error(`Missing Figma mode value for composed color alias: ${id}`); | ||
| } | ||
| active.add(id); | ||
| const resolved = resolve(variable.valuesByMode[targetModeID]); |
This was referenced Oct 27, 2026
This branch has not been deployed
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.

Changes
Fixes #882. Import composed COLOR values with numeric or aliased opacity, include their hidden color/opacity dependencies, and detect cycles. Ordinary aliases remain unchanged. Adds synthetic regression tests and a patch changeset; no private Figma data is included.
How to Review
Review composed-color.ts and the new figma-composed-colors.test.ts. Composed values become literal sRGB with authored opacity replacing the source alpha. Mode IDs are scoped to the source collection: cross-collection references use its corresponding named mode, falling back to the target collection default. This does not retain independently selected modes as a computed DTCG alias.
Verified: CLI suite (44 tests), CLI lint/type check, and CLI plus dependency builds/package export checks. Added coverage for reused IDs with different mode names and values. Existing base-branch tests were not changed. AI assistance is disclosed through commit co-authors.