This Figma plugin converts Figma design tokens/variables into WordPress theme.json format, placing all variables under the
settings.customsection according to WordPress standards.
New variables will be added under settings.custom
Typography Presets: (10up tooling feature)
settings.custom.typography.presetsSee TYPOGRAPHY-GUIDE.md for detailed information
Color Presets:
settings.color.paletteSee COLOR-PRESETS-GUIDE.md for detailed information
Spacing Presets:
settings.spacing.spacingSizesThe plugin generates a valid WordPress theme.json file with all variables placed under the settings.custom section:
{
"version": 3,
"settings": {
"custom": {
"color": {
"primary": "#000000",
"secondary": "#ffffff",
"accent": "var(--wp--custom--color--primary)",
"button": {
"default": {
"background": "var(--wp--custom--color--button--primary--default--background)",
"text": "var(--wp--custom--color--button--primary--default--text)"
},
"hover": {
"background": "var(--wp--custom--color--button--primary--hover--background)",
"text": "var(--wp--custom--color--button--primary--hover--text)"
}
}
},
"spacing": {
"base": "8px",
"large": "24px"
}
}
}
}
When uploading an existing theme.json file:
- The plugin preserves all existing theme settings and styles
- New variables from Figma are merged into the settings.custom section
- Existing custom variables with the same name are updated with new values
- Other sections of the theme.json file remain untouched
- Color modes and button styles are still exported as separate files
The plugin provides special handling for certain Figma variable collections:
Variables from a collection named "Primitives" are used as the base theme and are always processed first.
If a collection named "Color" has multiple modes:
- The first mode is merged into the main theme.json
- Each mode (including the first) is also exported as a separate file: styles/section-{mode-name}.json
- These files include proper metadata for WordPress theme variations
When the "Color" collection includes a "button" group with variants:
- Button variant properties from the primary button are referenced at the root level with CSS variables
- Each non-primary button variant (e.g., secondary, tertiary, etc.) is exported as a separate file: styles/button-{variant-name}.json
- These files include proper metadata for WordPress block style variations
The plugin can generate typography presets from Figma text styles:
If a collection has exactly two modes named "Desktop" and "Mobile", the plugin treats them as responsive variables:
{
"spacing": {
"base": {
"fluid": "true",
"min": "8px",
"max": "16px"
}
}
}
Note: The "fluid" property is output as a string value "true" rather than a boolean to ensure compatibility with WordPress theme.json parsing.
The plugin automatically adds "px" units to numeric values in appropriate categories: - spacing - font - size - grid - radius - width - height
The plugin automatically converts references between variables to WordPress CSS custom property format. According to WordPress conventions:
--wp--custom---- separatorFor example:
settings.custom.colorPalette.brandAccent → var(--wp--custom--color-palette--brand-accent)
This ensures that your theme.json file follows WordPress best practices and that all variable references will work correctly in your theme.
For more information on the WordPress theme.json format, see the WordPress documentation.
The plugin can generate WordPress color presets from your Figma color variables, making them available in the WordPress block editor's color picker. For comprehensive information about this feature, see COLOR-PRESETS-GUIDE.md.
settings.color.paletteThe plugin automatically generates WordPress spacing presets from Figma spacing variables. For detailed information about spacing presets, see SPACING-GUIDE.md.
24_16 becomes "Fluid (16 → 24)")settings.spacing.spacingSizesThe plugin generates several types of files depending on your configuration and Figma setup:
settings.customsection-{mode-name}.jsonIncludes proper WordPress theme variation metadata
Button Style Files (when applicable)
button-{variant-name}.jsonFor a complex setup, you might get:
wordpress-theme-files.zip
├── theme.json # Main theme file
└── styles/
├── section-light.json # Light color mode
├── section-dark.json # Dark color mode
├── button-secondary.json # Secondary button variant
└── button-tertiary.json # Tertiary button variant
All files are packed into a single zip download for easy use in WordPress themes.
For comprehensive information on specific features, see these detailed guides:
This plugin uses TypeScript and the Figma Plugin API. To develop:
npm installnpm run watchcode.tsThe plugin will automatically transpile TypeScript to JavaScript.
Beta: This project is quite new and we're not sure what our ongoing support level for this will be. Bug reports, feature requests, questions, and pull requests are welcome. If you like this project please let us know, but be cautious using this in a Production environment!
A complete listing of all notable changes to this project are documented in CHANGELOG.md.
This project uses Changesets for version management and changelog generation. When contributing, you'll need to include a changeset with your pull request.
When you make changes that should be released, run:
npm run changeset
This will prompt you to: 1. Select which packages should be bumped (for this single-package repo, select the main package) 2. Choose the type of change (patch, minor, or major) 3. Write a summary of your changes
The changeset will be saved as a file in the .changeset directory and should be committed with your changes.
npm run changeset and selecting no packages to bumpWhen changesets are merged to the main branch: 1. A "Release" pull request will be automatically created 2. This PR will update the
$ claude mcp add figma-to-wordpress-theme-json-exporter \
-- python -m otcore.mcp_server <graph>