Skip to content

Conversation

@aduth
Copy link
Member

@aduth aduth commented Nov 18, 2025

What?

  • Updates the Theme package internal Figma plugin to handle additional spacing properties added in UI: Implement Box component as part of new UI package #72984, following similar conventions to color property conversions
  • Expands on documentation to elaborate on what these "conventions" are with regard to expected naming schemes for general design tokens

This is meant to pair with accompanying changes in Automattic/figma-ds-token-manager#6 . This custom Figma plugin is intended to provide designers a way to easily consume design tokens in Figma documents. Word is that Figma will be supporting this natively in the near future, so a custom plugin may not be needed for very long.

Why?

  • Consistency with color tokens
  • Better documentation to ensure clear communication of design token decisions

Testing Instructions

Verify accuracy of changes to README.md and figma.json outputs.

Ensure no local changes to commit after running npm run --workspace @wordpress/theme build.

@aduth aduth requested a review from jameskoster November 18, 2025 21:55
@aduth aduth added [Type] Task Issues or PRs that have been broken down into an individual action to take [Package] Theme /packages/theme labels Nov 18, 2025
Copy link
Contributor

@jameskoster jameskoster left a comment

Choose a reason for hiding this comment

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

LGTM

@aduth aduth force-pushed the add/theme-density branch from b7c4da6 to 79291f9 Compare November 19, 2025 14:46
Base automatically changed from add/theme-density to trunk November 20, 2025 18:51
@aduth aduth force-pushed the update/theme-figma-plugin-density branch from 1a77e22 to 9dc5ed8 Compare November 21, 2025 15:52
@aduth aduth marked this pull request as ready for review November 21, 2025 15:52
@aduth aduth requested a review from a team as a code owner November 21, 2025 15:52
@github-actions
Copy link

github-actions bot commented Nov 21, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: aduth <aduth@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@aduth aduth marked this pull request as draft November 21, 2025 16:06
@aduth
Copy link
Member Author

aduth commented Nov 21, 2025

@jameskoster I pushed a few more improvements:

  • Removed "Semantic/" folder in the output
  • Removed tone values from variable names (already implied by folder)
  • Removed abbreviations for target elements
  • Updated source color tokens to express via nesting, e.g. { "bg-surface": {}, "bg-interactive": {} } ➡️ { "bg": { "surface": {}, "interactive": {} } }

Example before / after:

  • Before: Color/Semantic/Foreground/Success/fgCon-success
  • After: Color/Foreground/Success/fgContent

@aduth aduth marked this pull request as ready for review November 21, 2025 16:46
@aduth aduth requested a review from jameskoster November 21, 2025 16:47
@jameskoster
Copy link
Contributor

Updated source color tokens to express via nesting, e.g. { "bg-surface": {}, "bg-interactive": {} } ➡️ { "bg": { "surface": {}, "interactive": {} } }

Nice!

'warning',
'caution',
'error',
] );
Copy link
Member

Choose a reason for hiding this comment

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

In other places we call these "tones" as "color ramps". Could we use the same name here?

Copy link
Member Author

Choose a reason for hiding this comment

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

In other places we call these "tones" as "color ramps". Could we use the same name here?

Hm, I think there might be value in differentiating. With how we're using these in color theming, I'd say that we use the seed value for a given tone to produce a color ramp, but not that tone and color ramp are the same (tone being a singular term describing a mood or meaning, and color ramps being the set of color values within that domain). Additionally, we produce color ramps from seeds which aren't associated with tones, like "bg" and "primary".

"description": "Background color for interactive elements with neutral tone and strong emphasis."
},
"Color/Semantic/Background/Neutral/bgInt-neutral-strong-active": {
"Color/Background/Neutral/bgInteractive-strong-active": {
Copy link
Member

Choose a reason for hiding this comment

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

The token names are now a combination of camel case bgInteractive and kebab case -strong-active. Could we unify that on the better-looking bg-interactive-strong-active? That's also the convention that the associated CSS variables use.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think this could be a good opportunity to revisit these variable renamings. I'm not positive what the original motivation was (perhaps Figma truncation?), but it creates some complexities to try to manage them. It'd be a lot easier to just keep them uniform.

Copy link
Contributor

Choose a reason for hiding this comment

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

Originally we shortened things like "bgInteractive" to "bgInt" because the variable selection UI is quite narrow, but this doesn't look too bad:

Screenshot 2025-12-04 at 09 27 25

I think there's more value in uniformity.

Speaking of which, I noticed that how we've structured the tokens in Figma means the code snippets in "Dev mode" are pretty wonky:

Screenshot 2025-12-04 at 09 33 36

Maybe we should try restructuring to ensure alignment?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, that's an interesting point on the Dev Mode snippets. I'm not sure we can get those totally correct without completely upending how we've structured the colors into folders.

Copy link
Contributor

Choose a reason for hiding this comment

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

You mean in Figma? Is there any reason not to do that, if we want to? I think proper alignment would be quite helpful. Probably fine to tackle separately though.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we wanted parity I think it'd be more like:

wpds-color / bg / surface /
├ brand
├ ...

Which seems like it might be okay:

Screenshot 2025-12-04 at 16 09 40 Screenshot 2025-12-04 at 16 09 48 Screenshot 2025-12-04 at 16 09 58

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah we could create a folder for those targets like surface / interactive 👍

Copy link
Member Author

@aduth aduth Dec 5, 2025

Choose a reason for hiding this comment

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

I updated to simplify / align how the exported tokens retain details of the original tokens in e748ace. This feels a lot simpler, still creating folders for "type" ("color", "dimension"), "property" ("bg", "fg", "padding", etc.), and "target" ("surface", "interactive", etc.).

This required a few corresponding changes in Automattic/figma-ds-token-manager#6 which are now pushed there (af26c93).

Net result is that Dev Mode snippets are correct:

Screenshot 2025-12-05 at 11 39 04 AM

The variables panel and corresponding display in Figma fields aren't quite as ergonomic, but I think it's acceptable. This is aligned with what you shared above @jameskoster .

image image

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the color picking experience in Figma is fine, I really appreciate the alignment.

The only question I have now is whether it's worth using Collections. The duplicated collection name + group seems a bit strange, and the fact that each collection will only ever include a single root-level group may also be an indicator that collections aren't necessary...

With that said, a single collection would limit what we can do with modes which might come back to bite us later. Maybe it's fine to go with separate collections if we change the collection name to differentiate from the group (e.g. WPDS Color rather than wpds-color). WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, the main thing to keep in mind with collections is ensuring we have room to support distinct modes. Aligning this to the token file groupings is an imperfect but reasonably good fit to be safe. I think this also works well for future compatibility as far as how Figma "Import" mechanic works (i.e. import a single DTCG JSON file to a single collection).

I think capitalizing the collection could be fine enough to implement if it'd help differentiate the collection and top-level group. I might explore if this is something we could add using extensions so we don't have to maintain a manual mapping or rely on some programmatic capitalization (can be error-prone, as mentioned elsewhere)

@aduth
Copy link
Member Author

aduth commented Dec 9, 2025

After having spent more time with Figma's recently launched DTCG import functionality, I feel like we can move away entirely from maintaining this Figma-specific plugin and use DTCG tokens directly, with some revisions on our end to fix up and restructure the tokens:

@aduth
Copy link
Member Author

aduth commented Dec 10, 2025

Closing in favor of #73860

@aduth aduth closed this Dec 10, 2025
@aduth aduth deleted the update/theme-figma-plugin-density branch December 10, 2025 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Theme /packages/theme [Type] Task Issues or PRs that have been broken down into an individual action to take

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants