Skip to content

Don't export new high contrast modes #1245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2025
Merged

Conversation

lukasoppermann
Copy link
Collaborator

This PR make sure that we only export indented color themes for Figma.

@lukasoppermann lukasoppermann requested a review from a team as a code owner August 7, 2025 06:26
@lukasoppermann lukasoppermann added the skip changeset Apply to PRs that should not result in a version bump. label Aug 7, 2025
@lukasoppermann lukasoppermann requested a review from a team as a code owner August 7, 2025 06:26
Copy link

changeset-bot bot commented Aug 7, 2025

⚠️ No Changeset found

Latest commit: 8bbdaeb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements selective Figma export functionality for color themes by adding an exportToFigma flag to each theme configuration. The change prevents high-contrast accessibility variants from being exported to Figma while maintaining their availability for other build processes.

  • Added exportToFigma boolean property to all theme configurations
  • Modified the Figma build script to filter themes based on the new flag
  • Set high-contrast themes to exportToFigma: false and all other themes to true

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
scripts/themes.config.ts Added exportToFigma property to all theme configurations, setting high-contrast variants to false
scripts/buildFigma.ts Updated to filter themes based on the new exportToFigma flag before processing

import {figma} from '../src/platforms/index.js'
import type {ConfigGeneratorOptions} from '../src/types/styleDictionaryConfigGenerator.js'
import {getFallbackTheme} from './utilities/getFallbackTheme.js'

const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> => {
const themes = origialThemes.filter(theme => theme.exportToFigma !== false)
Copy link
Preview

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

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

There's a typo in the variable name. 'origialThemes' should be 'originalThemes'.

Suggested change
const themes = origialThemes.filter(theme => theme.exportToFigma !== false)
import {themes as originalThemes} from './themes.config.js'
import {figma} from '../src/platforms/index.js'
import type {ConfigGeneratorOptions} from '../src/types/styleDictionaryConfigGenerator.js'
import {getFallbackTheme} from './utilities/getFallbackTheme.js'
const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> => {
const themes = originalThemes.filter(theme => theme.exportToFigma !== false)

Copilot uses AI. Check for mistakes.

Copy link
Contributor

github-actions bot commented Aug 7, 2025

Design Token Diff (Figma)

/figma/figma.json

+++ /home/runner/work/primitives/primitives/dist/figma/figma.json	2025-08-07 06:27:53.610517011 +0000
@@ -75,20 +75,15 @@
       "light protanopia deuteranopia",
       "dark protanopia deuteranopia",
       "light tritanopia",
-        "dark tritanopia",
-        "dark protanopia deuteranopia high contrast",
-        "dark dimmed high contrast",
-        "dark tritanopia high contrast",
-        "light protanopia deuteranopia high contrast",
-        "light tritanopia high contrast"
+        "dark tritanopia"
     ],
     "groups": [
       "shadow",
       "component (internal)",
-        "component shadow",
-        "component",
       "semantic",
-        "syntax"
+        "component",
+        "syntax",
+        "component shadow"
     ]
   },
   "base/typography": {
@@ -115,18 +110,13 @@
   "dist/figma/scales/dark.json",
   "dist/figma/scales/light-high-constrast.json",
   "dist/figma/scales/light.json",
-    "dist/figma/themes/dark-colorblind-high-contrast.json",
   "dist/figma/themes/dark-colorblind.json",
-    "dist/figma/themes/dark-dimmed-high-contrast.json",
   "dist/figma/themes/dark-dimmed.json",
   "dist/figma/themes/dark-high-contrast.json",
-    "dist/figma/themes/dark-tritanopia-high-contrast.json",
   "dist/figma/themes/dark-tritanopia.json",
   "dist/figma/themes/dark.json",
-    "dist/figma/themes/light-colorblind-high-contrast.json",
   "dist/figma/themes/light-colorblind.json",
   "dist/figma/themes/light-high-contrast.json",
-    "dist/figma/themes/light-tritanopia-high-contrast.json",
   "dist/figma/themes/light-tritanopia.json",
   "dist/figma/themes/light.json",
   "dist/figma/typography/typography.json"

Copy link
Collaborator

@langermank langermank left a comment

Choose a reason for hiding this comment

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

This is really nice, I like how there's a prop so we can quickly change our minds later if we want 😄

@langermank langermank merged commit 00ad9f1 into main Aug 7, 2025
32 checks passed
@langermank langermank deleted the figma-export-restrict-themes branch August 7, 2025 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changeset Apply to PRs that should not result in a version bump.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants