Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

Conversation

@aduth
Copy link
Member

@aduth aduth commented Nov 18, 2025

  • Removes assumptions around "light" as a default mode, since current theming algorithm does not have explicit dark or light modes. Instead uses "default" as default mode
  • Updates to remove handling of aliases to primitive values, as primitive values are no longer included in Figma JSON output
  • Adds handling for imported dimension values (padding, gap) as numeric values
  • Creates separate collections based on top-level grouping (i.e. "Color" and "Dimension"). This is because each grouping may have their own grouping-specific modes. For example, density should only affect dimension values. This is also necessary to support multiple modes across groupings.

Testing Instructions:

  1. Clone this repository
  2. Checkout this branch
  3. Install the Figma desktop app, if you don't already have it
  4. In the Figma desktop app, click the Figma logo in the top-left, and select "Plugins" -> "Development" -> "Import plugin from manifest"
  5. In the file explorer, select the manifest.json from the checked out copy of this repository
  6. Once activated, press Cmd+K and find the plugin under "Plugins & widgets" (it should have a "Development" tag)
  7. Import figma.json from Gutenberg output on the update/theme-figma-plugin-density branch (source)
dimension.mov

- Removes assumptions around "light" as a default mode, since current theming algorithm does not have explicit dark or light modes. Instead uses "default" as default mode
- Updates to remove handling of aliases to primitive values, as primitive values are no longer included in Figma JSON output
- Adds handling for imported dimension values (padding, gap) as numeric values
- Creates separate collections based on top-level grouping (i.e. "Color" and "Dimension"). This is because each grouping may have their own grouping-specific modes. For example, density should only affect dimension values.
@aduth
Copy link
Member Author

aduth commented Nov 18, 2025

See accompanying changes to token output to format dimension tokens similar to color groupings: WordPress/gutenberg#73407

@jameskoster
Copy link

Amazing :D Tiny detail; should the modes be capitalised? 🤔

@aduth
Copy link
Member Author

aduth commented Nov 19, 2025

Tiny detail; should the modes be capitalised? 🤔

They could be. The challenge here is that these modes are driven from DTCG extensions, so often use a lower-cased, kebab-case or dot-delimited format in how they're named. We could capitalize them through some utility function (an equivalent of a Lodash capitalize, for example), but it may not always be perfect.

One example being something like how we're using high-dpi "mode" for focus ring tokens. Most programmatic ways of capitalizing that would output it as "High dpi" or "High Dpi", which isn't ideal either 🙈

@aduth
Copy link
Member Author

aduth commented Nov 19, 2025

There's also a point to both maintainability and future compatibility.

What @ciampo implemented around formatting color names to values like bgSur-neutral is nice to work with as an end result, but it adds a lot of overhead and technical complexity, and need to be manually managed. So it creates some future burden for us to maintain as we expand the tokens (see example). And there's a bit of mental overhead here too in how the naming is out of sync with how we reference them in the source tokens.

With Figma mentioning that they plan to launch both DTCG imports as well as improved management for variable collections, I'm not sure how compatible or necessary all of our manual finesse-ing of token names will be.

@aduth
Copy link
Member Author

aduth commented Nov 19, 2025

They could be. The challenge here is that these modes are driven from DTCG extensions, so often use a lower-cased, kebab-case or dot-delimited format in how they're named. We could capitalize them through some utility function (an equivalent of a Lodash capitalize, for example), but it may not always be perfect.

One example being something like how we're using high-dpi "mode" for focus ring tokens. Most programmatic ways of capitalizing that would output it as "High dpi" or "High Dpi", which isn't ideal either 🙈

Maybe we could manually map these. I don't think there'll be too many modes (I hope not, for the sake of folks working on the designs), so if it comes down to mapping "Compact", "Comfortable", and "High DPI", that seems manageable enough.

@jameskoster
Copy link

Hah, like I said, it's a tiny detail. If there's not a very simple solution we don't need to worry about it imo.

@jameskoster
Copy link

jameskoster commented Nov 19, 2025

I'm not able to run the plugin for some reason. Importing the manifest seems to work, but I get the following error when I try to run the plugin:

Error: Unable to load code: Error: Error invoking remote method 'web:getLocalFileExtensionSource': Error: ENOENT: no such file or directory, lstat '/Users/jameskoster/Sites/figma-ds-token-manager/dist/code.js'

I tried building the plugin (npm run build) which seemed to do something, but didn't fix the problem.

Nevermind, Node version issue. Working now :)

@jameskoster
Copy link

I notice none of the primitive tokens are imported. Is that intentional, or perhaps a consequence of how we expose them in the Gutenberg theme package? From my testing:

  • Using the published version of the plugin and importing from Gutenberg = no primitives.
  • Using the published version of the plugin and importing from CIAB = all primitives and semantics importing as expected.
  • Using this branch and importing from Gutenberg = no primitives.
  • Using this branch and importing from CIAB = primitives, but many missing semantics.

One other detail I'm not sure about, and I guess it's something we can discuss separately, is how we organise the variable Collections in Figma. Based on our need for modes ChatGPT suggests the following:

📁 1. Foundations

Primitive tokens

  • Color (no modes)
  • Radius
  • Border width
  • Elevation
  • Spacing (with density modes)
  • Sizing (with modes) — interesting how it split sizing out from spacing unprompted.

📁 2. Semantic / Color

Semantic palette (no modes)

📁 3. Semantic / Dimensions

Control sizes with modes: default, compact, large
Padding, gaps, etc. with density modes

Either way it would be nice to remove the WPDS Tokens/ prefix in collection names. I'm not sure how much value that's adding :D

@aduth
Copy link
Member Author

aduth commented Nov 19, 2025

I notice none of the primitive tokens are imported. Is that intentional, or perhaps a consequence of how we expose them in the Gutenberg theme package? From my testing:

This was a side-effect of the inlining changes in WordPress/gutenberg#72890 , which was both surprising and not surprising to me. I think it's a good point to raise, since I could see some value in representing the raw set of values in the Figma collection.

On the other hand, I think the reasons for inlining values in CSS (i.e. public consumers should only need to care about and reference semantic values) could also extend to Figma variables.

On the third hand (😂 ), the future Figma DTCG import support will likely import these primitives anyways, so there could be some value in aligning (or not bothering if we can plan for that future support).

@aduth
Copy link
Member Author

aduth commented Nov 19, 2025

Either way it would be nice to remove the WPDS Tokens/ prefix in collection names. I'm not sure how much value that's adding :D

Yeah I was looking at this earlier as well and thinking it quite verbose (plus the lack of formatting around the slash). Depending if we need to bother including both semantic and primitive, my thought was that we could call these collections "WPDS [Grouping]" (i.e. "WPDS Color" and "WPDS Dimension" currently).

@jameskoster
Copy link

Yeah I kind of came to the conclusion that it's not essential for the primitives to be included in Figma. As you say, designers should always be using semantic tokens, and I guess it matches the code after recent updates.

This changes how we approach the collection organisation too. We could even potentially have a single 'WPDS' collection with Colors and Dimensions as groups, which would simplify things, but also restricts modes which may cause issues later. On balance I think your suggestion "WPDS Color", "WPDS Dimensions" sounds good.

@aduth
Copy link
Member Author

aduth commented Nov 20, 2025

Yeah I'm not huge on the separate collections, but it's necessary if we ever need to support more than one mode being active at a time.

While we don't export primitive values, alias handling should be a basic functionality to support that we might leverage in the future
@aduth
Copy link
Member Author

aduth commented Nov 21, 2025

Latest commits remove "Tokens/" from the collection name (e.g. "WPDS Tokens/Dimension" ➡️ "WPDS Dimension").

This needs to be tested with the output from WordPress/gutenberg#73407 , since it now also encodes expectation that the output will no longer include "Semantic" groupings.

I think I'm reluctant to avoid introducing nice labels for modes, for improved future compatibility with generic DTCG tokens imports if we can ever get to a state where we don't need to maintain this ourselves.

@jameskoster
Copy link

jameskoster commented Dec 1, 2025

I think there's a bug with scope application:

  • Colors have no scopes at all (meaning they cannot be applied).
  • Padding tokens are scoped to "Width & height", instead of "Gap (Auto layout)".

Edit: I notice I'm still seeing the "Semantic" groupings too, so I'm thinking I have an issue with my build somewhere 😪

@aduth
Copy link
Member Author

aduth commented Dec 1, 2025

@jameskoster You'll need to use the figma.json from the accompanying Gutenberg changes in WordPress/gutenberg#73407

The original instructions pointed to the copy from trunk, but the changes here require some structural changes from that branch. I've updated the instructions to point to the figma.json from the update/theme-figma-plugin-density branch.

@jameskoster
Copy link

I thought that was what I was doing, but maybe the json wasn't building correctly. It's working now :D

Screenshot 2025-12-03 at 11 25 48

@jameskoster
Copy link

One small scoping issue I noticed; foreground colors are scoped so they can be applied to strokes. I think we may have originally set it up this way because we were exploring stroke-based icons. But that has been de-prioritised, so we might want to scope stroke colors only to strokes for now.

Otherwise this seems good :)

Screenshot 2025-12-08 at 10 24 16

@aduth
Copy link
Member Author

aduth commented Dec 10, 2025

Update: With Figma now supporting DTCG token imports natively, I'm going to propose we invest our efforts into ensuring our tokens can be imported directly. In other words, I'd like to suggest that this plugin has served its purpose but is no longer necessary and should be sunset.

In Gutenberg, I've proposed and will be merging a handful of pull requests to improve support for importing tokens into Figma:

@aduth aduth closed this Dec 10, 2025
@aduth aduth deleted the update/dimension-compat branch December 10, 2025 19:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants