Skip to content

Import Figma composed colors with authored opacity - #883

Open
heddendorp wants to merge 2 commits into
terrazzoapp:mainfrom
heddendorp:codex/figma-composed-colors
Open

heddendorp wants to merge 2 commits into
terrazzoapp:mainfrom
heddendorp:codex/figma-composed-colors

Conversation

@heddendorp

@heddendorp heddendorp commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

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.

Co-authored-by: Codex <noreply@openai.com>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 16:10
@changeset-bot

changeset-bot Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0054310

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@terrazzo/cli Patch
@terrazzo/parser Patch
@terrazzo/plugin-css-in-js Patch
@terrazzo/plugin-css Patch
@terrazzo/plugin-js Patch
@terrazzo/plugin-sass Patch
@terrazzo/plugin-tailwind Patch
@terrazzo/plugin-vanilla-extract Patch
@terrazzo/token-tools Patch
@terrazzo/token-types Patch

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread packages/cli/src/import/figma/composed-color.ts
Co-authored-by: Codex <noreply@openai.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Nested references retain the original mode context after a default fallback, which can produce incorrect RGB values.

1 open issue
1 resolved since last review

Review effort: Balanced

throw new Error(`Missing Figma mode value for composed color alias: ${id}`);
}
active.add(id);
const resolved = resolve(variable.valuesByMode[targetModeID]);

This branch has not been deployed

No deployments
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.

Figma composed color variables import with undefined color components

2 participants