npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

figma-tokens-flattener

v1.2.18

Published

A tool for transforming Ant Design tokens from Tokens Studio for Figma (Single file) into flat style mappings for light and dark themes.

Readme

figma-tokens-flattener

A tool for transforming Ant Design tokens from Tokens Studio for Figma (Single file) into flat style mappings for light and dark themes.

Installation

npm install figma-tokens-flattener --save-dev

Create Configuration

Create a figma-tokens-flattener-config.json file in your project root:

{
    "source": {
        "tokensFile": "src/tokens/tokens.json" // path to the token file
    },
    "target": {
        "jsonsDir": "src/tokens" // path for the created files
    }
}

Run Transformation

npx simple-token-transformer flatten

Alternative Way (Recommended)

Add a script to your package.json:

{
    "scripts": {
        "flatten-tokens": "figma-tokens-flattener"
    }
}

And run with:

npm run flatten-tokens

How It Works

  1. Reading Tokens - The tool reads the JSON file exported from Tokens Studio for Figma

  2. Theme Separation - Automatically splits tokens into light and dark themes

  3. Flat Structure Transformation - Converts nested token structure into flat mapping

  4. Result Saving - Creates separate JSON files for each theme

Output

After running the command, the following files will be created in the target directory:

light.json - tokens for light theme

dark.json - tokens for dark theme

Custom theme parsing

The designer creates a new theme based on a light theme.

  1. Make a duplicate of the light theme in figma
  2. In the token studio plugin, place the actual colors at the positions alias, map, seed, colors
  3. Upload as a single file
  4. Upload custom variable colors via any tokens pro type token and remove unnecessary fields with a simple script

frontend developer receives 2 files.

  1. tokens.json (the usual cast of the theme from figma)
  2. *_variable.json file that contains the structure to be referenced from tokens.json the name must be strictly "*_variable.json" ("example_variable.json", "sky_variable.json" etc.)
  3. In tokens.json we will have json links (where needed):
"blue": {
   "1": {
   "value": "{Sky.core.blue.F5FAFE}",
   "type": "color"
   },
   }
  1. In example_variable.json, we will have values along the link paths
{
    "Sky": {
        "core": {
            "blue": {
                "F5FAFE": {
                    "value": "#f5fafe",
                    "type": "color"
                }
            }
        }
    }
}
  1. The variables file is located in the same directory as the token.json file. The values will be substituted and we will be able to get any custom theme.

This approach allows you to create any custom themes based on the bright standard antd theme.