Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Welcome to the Specify docs! Learn about how to use and integrate Specify in your workflow to sync your design tokens and assets in your design system.
Specify is built on core concepts such as sources, destinations, pipelines, parsers. This page will help you understand all of them.
A Design API is an API designed to synchronize information in your design system. This includes design tokens, assets, components and documentation.
A source is a place that contains data you want to sync within your design system. Like a Figma file from which you sync your colors from. Or a GitHub repository containing your design tokens in JSON.
A destination is a place in which you distribute data in. Like a GitHub repository consuming colors coming from your design system or a Notion database in which you document your icons.
A pipeline is the route that connects a Source or a Destination to Specify. It helps you transform and synchronize data (e.g., design tokens) within your design system.
A repository is like a folder containing your design tokens and assets in Specify. Use repositories to store and organize your design data.
A Token type is a type of design token or asset supported by Specify like a colors, a text style or an icon. See all token types.
By default Specify returns design tokens and assets in JSON. Configure it to generate design data compatible with your company standards (e.g., CSS Variables).
A rule is a part of your configuration that helps you transform one or several Token types the way you want. Like a rule to pull colors from Specify as CSS Variables in a CSS file.
Parsers are functions allowing you to transform design tokens and assets coming from Specify to fit your needs and company standards. See all parsers.
We provide the first Design Data Platform allowing you to send your design tokens and assets across your design system tools. Specify is built with this idea: configure once, synchronize anytime.
Specify is a central and tool-agnostic platform. It means you can integrate your daily applications to collect, store and distribute your design decisions to the right teams, in the right format, at the right time. To sum things up, see Specify as the synchronization layer for your design data at the heart of your design system.
Designers, connect your favorite design tool, like Figma, and let Specify monitor and collect your design tokens and assets automatically. This way, you control what is sent to developers and reduce the risk of inconsistencies.
Teams can benefit from a single source of truth and a continuous delivery system that ensures brand consistency.
In short, you have more time to focus on what matters most: your products and your end-users.

A 5min guide on collecting and pulling your first design tokens and assets with Specify.
In this guide you’ll learn how to pull your first design tokens and assets to CSS Custom Properties using the Specify CLI.
To get the most out of this guide, you’ll need:
A Specify account
A Specify repository containing some design tokens and assets (Learn more ↗)
Install @specifyapp/cli via npm or Yarn.
npm install -g @specifyapp/cliyarn global add @specifyapp/cliCreate a configuration file for your desired output format using one of our templates ↗️
specify initAdd your Specify repository from which you want to pull your design tokens and assets. Learn more ↗.
module.exports = {
  repository: '@workspace/repository',
  personalAccessToken: '<your-personal-access-token>',
  rules: [],
};{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": []
}Generate a personalAccessToken for the CLI and add it in your configuration.
module.exports = {
  repository: '@workspace/repository',
  personalAccessToken: '<your-personal-access-token>',
  rules: [],
};{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": []
}Our configuration is ready and we can now pull our design tokens and assets using the pull command.
specify pullHere’s a 5 minute guide on how to use different features within the Advanced Repository based on the Specify Design Token Format.
Specify is building an entirely new Design Token Format (SDTF) to base our platform on a new design token graph. In short, this means that we are developing a format that enables more possibilities to add code-type sources and destinations than before. The new graph will facilitate managing a large number of design token types and assets. Next to this, it opens doors to more advanced features such as Aliases, Modes, and Collections.
In a more practical sense, the SDTF opens up compatibility with and as a source alongside the existing Figma local styles compatibility. It also creates opportunities to create code output that includes aliases, modes, and collections.
All of these features come together in the Specify Advanced Repository.
Your Specify personal access token should always be private. We highly recommend you to set it in a private variable or in a .env variable.
SPECIFY_TOKEN=ab83f8f49f5c65456c7b1fe70efbc804aa08f87150214aa984d4125945ed8283bashconst path = require('path');
const envFile = '.env';
require('dotenv').config({ path: path.resolve(process.cwd(), envFile) });
module.exports = {
  repository: '@workspace/repository',
  personalAccessToken: process.env.SPECIFY_TOKEN,
  rules: [],
};Set your personal access token as an environment variable and interpolate it in the CLI wit the flag -p.
specify pull -p $SPECIFY_TOKENLearn how to distribute your design tokens from Specify to your GitHub repositories via automated Pull Requests.
Please make sure you have:
A GitHub account
A Specify account
One or multiple new Advanced Repositories Specify repositories containing some design tokens.
Go to the applications catalog
Select GitHub
Click on "Connect"
Select the repositories you want Specify to have access to
You will now be able to connect your Specify and your GitHub repositories together 🎉
Once you've connected your GitHub account, Specify has to know what design tokens to synchronize and how.
Go to the Specify Advanced Repository you want to distribute design data from
Go to its "Destinations" page
Click on "Create Pipeline"
Select "GitHub application"
Select your GitHub account
Select the GitHub repository you want to distribute your design data to
Name for your configuration file ()
Create the Pull Request containing your configuration file
Merge the PR created by Specify containing your configuration file
Specify will now automatically sync design data to your GitHub repository 🎉
The Specify CLI helps you pull design tokens and assets from Specify right from your terminal.
Use the Specify CLI to integrate Specify in your workflow.
You can use the Specify CLI to:
Pull your design tokens in the right format using parsers
Test your configuration before using it in a GitHub repository
Sync a Specify repository
Install @specifyapp/cli via npm or Yarn.
Initialize a Specify configuration tailored for a specific output format. .
Pull design tokens and assets from your Specify repository.
Sync a Specify repository to update its design tokens and assets.
Flags are parameters you can pass while launching the command. All of these parameters are optional if you use a config file.
Relative path to your Specify config file.
The name of the Specify repository you want to pull your design tokens and assets from.
The Specify Personal Access Token used to authenticate your actions.
Rules Specify will follow to generate design tokens and assets in your desired output format.
Execute command without actually writing files. Use this flag to test the output of a configuration without generating files.
Automatically distribute your design tokens and assets according to your organization's standards with our ready-to-use configuration templates.
This section will help you get started with ready-to-use configuration template. Each configuration file will be filled by one or several rules, called parsers.
Parsers are functions allowing you to transform design tokens and assets coming from Specify to fit your needs and company standards.
This template is dedicated for Web developers using CSS. It helps you generate all types of design tokens as CSS Custom Properties in their respective CSS file.
This template helps you pull your design tokens in the SDTF format in a JSON file.
This template helps you generate your design tokens as a Tailwind theme.
npm install -g @specifyapp/cliyarn global add @specifyapp/clispecify initspecify pull [flags]specify sync [flags]
This template helps you pull your design tokens in the SDTF format in a JSON file.
This example uses the following parser:
to-sdtf to generate your design tokens in SDTF
If you use the CLI, you need to fill three properties:
repository  is @organization/repository
personalAccessToken which you can generate in your account settings 
rules are where you provide parsers and compatible options
{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Generate tokens in SDTF",
      "parsers": [
        {
          "name": "to-sdtf",
          "output": {
            "type": "file",
            "filePath": "output/tokens.json"
          }
        }
      ]
    }
  ]
}If you use the GitHub, you need to fill two properties:
repository  is @organization/repository
rules lets you transform tokens by chaining parsers
{
  "version": "2",
  "repository": "@organization/repository",
  "rules": [
    {
      "name": "Generate tokens in JSON",
      "parsers": [
        {
          "name": "to-sdtf",
          "output": {
            "type": "file",
            "filePath": "output/tokens.json"
          }
        }
      ]
    }
  ]
}Learn to get and use your design tokens and assets right from Raycast.
Our Raycast extension helps you search your design tokens and assets and use them in your favorite tools: Notion pages, Pitch presentations, Slack discussions, etc.
Please make sure you have:
Raycast installed
A Specify account
A Specify repository containing some design tokens and/or assets
Generated a Personal Access Token for Raycast
You can sync the following Token types in Raycast:
color
bitmap
vector
Install the Specify Raycast extension from the Raycast store
Set your newly created Personal Access Token in Raycast
Are you looking for a specific color from your design system? Open Raycast and type in Search Colors.
The main action is to copy the hexadecimal value of your color. You can also access other actions like copying the value in RGBA or the name of the color by accessing the action menu via Cmd + K.
Are you looking for a .jpg or .png file, such as a logo or photo of a team member? As with the previous search, open Raycast and type in Search Bitmaps.
Are you looking for a .svg file, such as a logo or an icon? Just open Raycast and type in Search Vectors.
Learn how to automatically document your design tokens and assets from Specify to your Notion workspace.
Use our Notion integration to:
Document your brand guidelines
Create public pages for press and brand kits
Automate the maintenance of your design system documentation
Please make sure you have:
A Notion account
A Specify account
A Specify repository containing some design tokens and/or assets
You can sync the following Token types in Notion:
color
measurement
textStyle
bitmap
font
vector
Learn how to use the Specify Playground to iterate more easily on your configuration files
The Specify Playground helps you run parsers against a token graph and see the generated output in live. It's a great tool to help you iterate on your configuration files or try new parsers on the go.
https://iframe.specifyapp.com/sdtf-playground/index.html
The left side panel contains the SDTF graph you'll run your rules against. It's editable and you're free to use your own SDTF graph which you can get with the to-sdtf parser.
The middle panel contain your Specify configuration rule.
The right side panel displays the generated code
Learn how to distribute your design tokens and assets from Specify as npm or GitHub packages.
This integration helps you generate design tokens and assets as private or public packages in a npm or a GitHub registry.
Choose npm if you already have a private npm registry, we suggest you distribute your npm packages there. It will prevent you from creating a public npm package that will take an unnecessary public namespace.
Choose GitHub if you want to keep your packages private to your GitHub organization without paying for an npm team account.
Choose a custom registry if your company uses its own registry. If you have specific security constraints like IP whitelisting or custom authentication.
Please make sure you have:
An npm account, a GitHub account, or access to a custom registry
A Specify account
A Specify repository containing some design tokens and/or assets
Go to your Specify repository you want to distribute your design tokens from
Go to the "Destinations" page and click on "Create pipeline"
Select "npm packages"
Configure your package name, access type (public / private), and module type (Common JS / ES Modules)
Set your Specify configuration file. If you host your config file on an external service like JSONBIN make sure to make your BIN public (See example). Also, your config only needs the rules property.
In this guide, you’ll learn how to sync your Figma Variables and/or Styles to a Specify Repository and how to keep them updated.
To get the most out of this guide, you will need:
A Specify Account
A Figma file containing Variables and/or Styles
Access your Figma file which includes the Variables and/or Styles you would like to sync to Specify
the Specify Widget in the Figma file which includes your Variables and/or Styles. Or update the widget if you already have it. To update the Specify Widget you have to disconnect it, remove the entire frame in all of your Figma files, and reopen the latest version of the Widget.
Follow the steps in the widget to connect your account. You will need to create a personal access token and you will need to add the link to the Figma file to which the widget is added.
Click "Connect"
Choose Advanced Repository
Go to your Specify workspace
Click on "Create repository"
Choose a name
Select "Advanced Repository" ()
Click "Create repository"
Go back to your Figma file that includes the Variables and/or Styles
Click on "Create Source" in the Specify Widget
It will show you the local collections and styles that are detected
Select the design tokens format you want to collect from your Figma file.
Select the Specify repository you want to sync with. You should be able to see the Repository you have just created in Specify (if not, reload the list).
Click "Save to Specify"
You will immediately see the repository listed with the latest syncing time
Use the Sync button to update your Variables and/or Styles with Specify. Now you are ready to ! 🎉 
You will see the category of design tokens that are synced on the left-hand side
In the Sources section (left-hand menu), you will see your connection(s) and when the last sync between your Figma file and Specify repository has occurred.
Delete your source by clicking on the 3 dots option menu in the source card.
Learn how to distribute your design tokens and assets from Specify to your GitHub repositories via automated Pull Request.
Please make sure you have:
A GitHub account
A Specify account
A Specify repository containing some design tokens and/or assets
Go to the applications catalog
Select GitHub
Click on "Connect"
Select the repositories you want Specify to have access to
You will now be able to connect your Specify and your GitHub repositories together 🎉
Once you've connected your GitHub account, Specify has to know what design tokens to synchronize and how.
Go to the Specify repository page you want to distribute design data from
Go to its "Destinations" page
Click on "Create Pipeline"
Select "GitHub application"
Select your GitHub account
Select the GitHub repository you want to distribute your design data to
Select your configuration template ()
Create the Pull Request containing your configuration file
Merge the PR created by Specify containing your configuration file
Specify will now automatically sync design data to your GitHub repository 🎉
Have trouble getting Pull Requests in your GitHub repository? Learn more about .
The Specify API lets you extend Specify functionalities beyond what we provide out of the box.
Specify provides the following endpoint to help you get design tokens and assets from a Specify repository.
https://api.specifyapp.com/v2/{workspace}/repository/{repository}/execute-rule
POST https://api.specifyapp.com/v2/{workspace}/repository/{repository}/execute-rule
Get design tokens and assets from a Specify repository. You can only execute a single rule with this endpoint.
Once you have your personal access token, you can pass it within the Authorization header of your request.
Here's a simple example to get tokens in JSON from a repository called all-design-datain the @acme-inc workspace:
workspace*
String
The name of your organization in Specify. For instance, in this URL https://specifyapp.com/ @specifyapp/Seeds the workspace is "@specifyapp".
name
String
The name of the Specify repository containing the design data you're requesting. For instance, in this URL https://specifyapp.com / @specifyapp/Seeds the repository is "Seeds".
parsers*
Object or Array
Can contain an object or an array of objects. Each object corresponds to a specific parser.
name*
The name of your rule
curl -X POST 'https://api.specifyapp.com/v2/@acme-inc/repository/all-design-data/execute-rule' \
--header 'Authorization: <your-personal-access-token>' \
--header 'Content-Type: application/json' \
--data '{
    "name": "SDTF",
    "parsers": [
        {
            "name": "as-is",
            "output": {
                "type": "file",
                "filePath": "tokens.json"
            }
        }
    ]
}'






This parser helps you select design tokens from specific mode(s).
interface parser {
  name: 'select-modes';
  options: {
    modes: string[];
  };
}modes
required
Array
The query that select items in the graph.
{
  "colors": {
    "$collection": {
      "$modes": ["light", "dark"]
    },
    "info": {
      "infoToken": {
        "$type": "color",
        "$value": {
          "light": {
            "model": "rgb",
            "red": 219,
            "green": 234,
            "blue": 254,
            "alpha": 1
          },
          "dark": {
            "model": "rgb",
            "red": 219,
            "green": 234,
            "blue": 254,
            "alpha": 1
          }
        }
      }
    },
    "danger": {
      "dangerToken": {
        "$type": "color",
        "$value": {
          "light": {
            "model": "rgb",
            "red": 209,
            "green": 204,
            "blue": 204,
            "alpha": 1
          },
          "dark": {
            "model": "rgb",
            "red": 19,
            "green": 34,
            "blue": 54,
            "alpha": 1
          }
        }
      }
    }
  }
}We want to get all design tokens from the mode named "light"
We eventually generate our design tokens ass CSS variables in a CSS file thanks to the to-css-custom-properties parser.
{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Only get tokens from the mode named 'light' and gererate tokens in CSS",
      "parsers": [
        {
          "name": "select-modes",
          "options": {
            "modes": ["light"]
          }
        },
        {
          "name": "to-css-custom-properties",
          "options": {
            "selectorTemplate": "[data-theme=\"{{mode}}\"]"
          },
          "output": {
            "type": "file",
            "filePath": "public/css-custom-properties.css"
          }
        }
      ]
    }
  ]
}[data-theme="light"] {
  --danger-dangerToken: rgb(209, 204, 204);
  --info-infoToken: rgb(219, 234, 254);
}









Parsers are functions allowing you to transform design tokens and assets coming from Specify to fit your needs and company standards.
Not familiar with parsers? Head over to the existing parsers documentation and learn more about why you need them and how to use them.
You must set a name and your desired output for each parser:
The name is the name of the parser
The output property indicates which type of output you want the parser to produce
Parsers support none, some or more output types, please refer to dedicated parser pages for details.
Use case: the parser is expected to produce exactly one file.
Directory
Use case: the parser is expected to produce 0 to N files, all placed in the given directoryPath.
Example with the to-css-custom-properties parser:
The Specify API lets you extend Specify functionalities beyond what we provide out of the box.
The Specify API is based on REST structure. We support authentication via access tokens. Requests are made via HTTP endpoints with clear functions and appropriate response codes. Endpoints allow you to request design tokens and assets from a Specify repository.
Specify's REST API is useful if you want to use design data coming from Specify through custom scripts like a Figma plugin or a .
In short, our REST API helps you request design data through HTTP requests. Like with our you can use parsers to transform design data.
However, you cannot directly generate files using the REST API as it only returns text. You'll have to write custom scripts to generate design files (e.g., colors.css).
To sum things up, to generate files from Specify (e.g., colors.css or icon.svg) containing design tokens or assets use the  or our .
Specify provides the following endpoint to help you get design tokens and assets from a Specify repository.
https://api.specifyapp.com/repository/{workspace}/{repository}/design-tokens
POST https://api.specifyapp.com/repository/{workspace}/{repository}/design-tokens
Get design tokens and assets from a Specify repository.
Once you have your personal access token, you can pass it within the Authorization header of your request.
Here's a simple example to get colors in CSS variables from a repository called all-design-datain the @acme-inc workspace:
Specify uses standard HTTP response codes for success and failure notifications. Our errors are further classified by type. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted). Codes in the 5xx range indicate an error with Specify servers.
Some 4xx errors that could be handled programmatically include an error code that briefly explains the error reported.
type FileOutput = {
  type: 'file';
  filePath: string;
}type DirectoryOutput = {
  type: 'directory';
  directoryPath: string;
}"parsers": [
  {
    "name": "to-css-custom-properties",
    "output": {
      "type": "file",
      "filePath": "style.css"
    }
  }
  // ...
]This parser helps you change the case of names or modes over a SDTF graph.
This parser helps you convert the color formats of color compatible tokens over a SDTF graph.
This parser helps you filter a SDTF graph.
This parser helps you select design tokens from specific mode(s).
This parser helps you transform design tokens in CSS Custom Properties.
This parser helps you get your design tokens as a SDTF graph in JSON.
This parser helps you generate Style Dictionary raw token files for all your design tokens coming from Specify.
This parser helps you generate a Tailwind theme from all your design tokens coming from Specify.
This parser helps you pull design tokens as JavaScript objects for all token types and their respective getter functions.
This parser helps you pull design tokens in JSON with token values in JSON or CSS.
This parser helps you pull design tokens as TypeScript objects for all token types and their respective getter functions.
workspace*
String
The name of your organization in Specify.
For instance, in this URL https://specifyapp.com/@specifyapp/Seeds/color the workspace is "@specifyapp".
name*
String
The name of the Specify repository containing the design data you're requesting.
For instance, in this URL https://specifyapp.com/@specifyapp/Seeds/color the repository is "Seeds".
filter
Object
Set all the Token types you want to target.
"filter": { "types": [ "color", "font", "textStyle" ] }
parsers
Object or Array
Can contain an object or an array of objects. Each object corresponds to a specific parser.
{
    // Response
}{
    // Response
}{
    // Response
}{
    // Response
}{
    // Response
}curl -X POST 'https://api.specifyapp.com/repository/@acme-inc/all-design-data/design-tokens' \
  -H 'Authorization: <your-personal-access-token>' \
  -H 'Content-Type: application/json' \
  -d '{"filter": { "types": ["color"]}, "parsers": [{"name": "to-css-custom-properties"}]}'type
string
The type of error returned. One of api_connection_error, api_error, authentication_error, invalid_request_error, or rate_limit_error.
statusCode
string
For some errors that could be handled programmatically, a short string indicating the error code reported.
message
string
A human-readable message providing more details about the error.
validation
string
All invalid query / payload parameters. All invalid query / payload parameters. This property will be displayed on specific endpoints error response.

GitHub
Learn how to distribute your design tokens and assets via automated Pull Requests.
GitLab
Learn how to distribute your design tokens and assets via automated Merge Requests.
Azure DevOps
Learn how to distribute your design tokens and assets via automated Pull Requests.
REST API
Learn how to sync design tokens and assets with the Specify REST API.
CLI
Learn how pull design tokens and assets from Specify right from your terminal.
Notion
Learn how to automatically document your design tokens and assets from Specify to your Notion workspace.
Raycast
Learn to get and use your design tokens and assets right from Raycast.
Bitbucket
Learn how to distribute your design tokens and assets via automated Pull Requests.
npm
Learn how to distribute your design tokens and assets as npm packages.









This parser helps you get your design tokens as a SDTF graph in JSON.
interface parser {
  name: 'to-sdtf';
  output:
    | { type: 'directory'; directoryPath: string }
    | { type: 'file'; filePath: string }
    | { type: 'SDTF' }
    | { type: 'text' }
    | { type: 'JSON'; filePath: string };
}{
  "colors": {
    "$collection": {
      "$modes": [
        "light",
        "dark"
      ]
    },
    "Core": {
      "blue-100": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 29,
            "alpha": 1,
            "green": 29,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 255,
            "model": "rgb"
          }
        },
        "$description": "token 1 aliased with n modes within collection within n groups"
      },
      "blue-700": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 0,
            "alpha": 1,
            "green": 0,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 200,
            "model": "rgb"
          }
        },
        "$description": "token 2 aliased with n modes within collection within n groups"
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$value": {
                "dark": {
                  "$mode": "dark",
                  "$alias": "colors.Core.blue-100"
                },
                "light": {
                  "$mode": "light",
                  "$alias": "colors.Core.blue-700"
                }
              },
              "$description": "alias token with n modes within collection within n groups"
            }
          }
        }
      }
    }
  }
}{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Generate tokens in JSON",
      "parsers": [
        {
          "name": "to-sdtf",
          "output": {
            "type": "file",
            "filePath": "output/tokens.json"
          }
        }
      ]
    }
  ]
}{
  "colors": {
    "$collection": {
      "$modes": [
        "light",
        "dark"
      ]
    },
    "Core": {
      "blue-100": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 29,
            "alpha": 1,
            "green": 29,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 255,
            "model": "rgb"
          }
        },
        "$description": "token 1 aliased with n modes within collection within n groups"
      },
      "blue-700": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 0,
            "alpha": 1,
            "green": 0,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 200,
            "model": "rgb"
          }
        },
        "$description": "token 2 aliased with n modes within collection within n groups"
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$value": {
                "dark": {
                  "$mode": "dark",
                  "$alias": "colors.Core.blue-100"
                },
                "light": {
                  "$mode": "light",
                  "$alias": "colors.Core.blue-700"
                }
              },
              "$description": "alias token with n modes within collection within n groups"
            }
          }
        }
      }
    }
  }
}This parser helps you transform design tokens into CSS Custom Properties.
In this guide you’ll learn how to transform design data coming from Figma Variables, Figma Styles and/or Tokens Studio into CSS Custom Properties using the Specify CLI.
Install the @specifyapp/cli via npm or Yarn.
To create your Specify config file, you need to follow these steps:
Create an empty file named .specifyrc.json
Add the following content
A property version is shown which refers to the new Advanced Repository from which we are extracting tokens. Use the version: "2".
Add your organization and repository name under the repository property.
Get a personal access token .
Run the command specify pull to fetch your design tokens.
Specify exports your Figma Variables Modes as CSS data-attributes:
We would like to improve this output according to your needs as much as we can. Feel free to share your feedback with us via:
The in-app chat
This template helps you generate your design tokens as a Tailwind theme.
This example uses the following parser:
to generate your design tokens as a Tailwind theme
If you use the CLI, you need to fill three properties:
repository  is @organization/repository
personalAccessToken which you can generate  
rules are where you provide parsers and compatible options
If you use the GitHub, you need to fill two properties:
repository  is @organization/repository
rules lets you transform tokens by chaining parsers
interface parser {
  name: 'to-css-custom-properties';
  output: {
    type: 'file';
    filePath: string;
  };
  options?: {
    tokenNameTemplate?: string;
    selectorTemplate?: string;
    includeCoreTokensInScopes?: boolean;
  };
}selectorTemplate
optional
string
The pattern used to generate the CSS selector name(s). It must match mustache template syntax.
You can use collection, mode and groups names.
tokenNameTemplate
optional
string
The pattern used to generate token names. It must match mustache template syntax.
You can use collection, mode,groups and token names.
includeCoreTokensInScopes
optional
boolean
false
When set to true, you will have both core tokens and alias tokens in each CSS scopes thus making alias tokens always resolvable.
{
  "colors": {
    "$collection": { "$modes": ["Light", "Dark"] },
    "core": {
      "blue-100": {
        "$type": "color",
        "$description": "token 1 aliased with n modes within collection within n groups",
        "$value": {
          "Light": {
            "red": 219,
            "blue": 254,
            "alpha": 1,
            "green": 236,
            "model": "rgb"
          },
          "Dark": {
            "red": 41,
            "blue": 67,
            "alpha": 1,
            "green": 52,
            "model": "rgb"
          }
        }
      },
      "blue-700": {
        "$type": "color",
        "$description": "token 2 aliased with n modes within collection within n groups",
        "$value": {
          "Light": {
            "red": 17,
            "blue": 249,
            "alpha": 1,
            "green": 125,
            "model": "rgb"
          },
          "Dark": {
            "red": 96,
            "blue": 250,
            "alpha": 1,
            "green": 168,
            "model": "rgb"
          }
        }
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$description": "alias token with n modes within collection within n groups",
              "$value": {
                "Dark": {
                  "$mode": "Dark",
                  "$alias": "colors.core.blue-100"
                },
                "Light": {
                  "$mode": "Light",
                  "$alias": "colors.core.blue-700"
                }
              }
            }
          }
        }
      }
    }  
  }
}{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Generate tokens as CSS Custom Properties",
      "parsers": [
        {
          "name": "to-css-custom-properties",
          "output": {
            "type": "file",
            "filePath": "tokens.css"
          },
          "options": {
            "tokenNameTemplate": "--{{groups}}-{{token}}",
            "selectorTemplate": "[data-theme=\"{{mode}}\"]",
            "includeCoreTokensInScopes": true
          }
        }
      ]
    }
  ]
}[data-theme="dark"] {
  --core-blue-100: rgb(41, 52, 67);
  --core-blue-700: rgb(96, 168, 250);
  --semantic-background-button-primary-hover: var(--core-blue-100);
}
[data-theme="light"] {
  --core-blue-100: rgb(219, 236, 254);
  --core-blue-700: rgb(17, 125, 249);
  --semantic-background-button-primary-hover: var(--core-blue-700);
}interface parser {
  name: 'to-typescript';
  output: {
    type: 'file';
    filePath: string;
  };
  options?: {
    moduleExport?: 'es6' | 'commonjs';
  };
}{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "To TypeScript",
      "parsers": [
        {
          "name": "to-typescript",
          "output": {
            "type": "file",
            "filePath": "tokens.ts"
          }
        }
      ]
    }
  ]
}/** 
* @enum {string} All the valid paths for the collection colors.
* Use it when calling `getColorsTokenByMode`
*/
export const colorsColorPath = {
  'colors.Core.blue-100': 'colors.Core.blue-100',
  'colors.Core.blue-700': 'colors.Core.blue-700',
  'colors.semantic.background.button.primary.hover': 'colors.semantic.background.button.primary.hover'
} as const;
export type colorsColorPathType = keyof typeof colorsColorPath;
export type colorsPathType = colorsColorPathType;
/**
* All the modes of the collection colors.
* Use it when calling `getColorsTokenByMode`
*/
export const colorsModes = [ 'light', 'dark' ] as const;
export type colorsModesType = typeof colorsModes[number];
/** 
* All the tokens of the collection colors.
* Use `getColorsTokenByMode` to retrieve the tokens
*/
export const colors = {
  'colors.Core.blue-100': { dark: 'rgb(229, 29, 29)', light: 'rgb(255, 255, 255)' },
  'colors.Core.blue-700': { dark: 'rgb(229, 0, 0)', light: 'rgb(255, 200, 255)' },
  'colors.semantic.background.button.primary.hover': { dark: 'rgb(229, 29, 29)', light: 'rgb(255, 200, 255)' }
} as const;
/**
* Retrieve a token for the collection 'colors'.
* @param {keyof typeof colorsPath} path - The path to the token
* @param {'light' | 'dark'} mode - The mode of the token you want to retrieve 
* @returns {number | string} The value of a token for a given mode
*/
export function getColorsTokenByMode<T extends colorsPathType, M extends keyof typeof colors[T]>(path: T, mode: M) {
  if (!colors[path]) {
    throw new Error("Path: '" + path + "' doesn't exist for collection 'colors'. Here are all the valid paths for each type:" + `
- color:
    - colors.Core.blue-100
    - colors.Core.blue-700
    - colors.semantic.background.button.primary.hover`)
  }
  if (!colors[path][mode]) {
    throw new Error("Invalid mode '" + mode.toString() + "' for collection 'colors' at path '" + path + "', here are all the valid modes:\n- " + Object.keys(colors[path]).join('\n- '))
  }
  return colors[path][mode]
}{
  "colors": {
    "$collection": {
      "$modes": [
        "light",
        "dark"
      ]
    },
    "Core": {
      "blue-100": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 29,
            "alpha": 1,
            "green": 29,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 255,
            "model": "rgb"
          }
        },
        "$description": "token 1 aliased with n modes within collection within n groups"
      },
      "blue-700": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 0,
            "alpha": 1,
            "green": 0,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 200,
            "model": "rgb"
          }
        },
        "$description": "token 2 aliased with n modes within collection within n groups"
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$value": {
                "dark": {
                  "$mode": "dark",
                  "$alias": "colors.Core.blue-100"
                },
                "light": {
                  "$mode": "light",
                  "$alias": "colors.Core.blue-700"
                }
              },
              "$description": "alias token with n modes within collection within n groups"
            }
          }
        }
      }
    }
  }
}{
  "version": "2",
  "repository": "@organization/repository",
  "rules": [
    {
      "name": "Generate tokens as a Tailwind theme",
      "parsers": [
        {
          "name": "to-tailwind",
          "output": {
            "type": "file",
            "filePath": "theme.js"
          }
        }
      ]
    }
  ]
}{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Generate tokens as a Tailwind theme",
      "parsers": [
        {
          "name": "to-tailwind",
          "output": {
            "type": "file",
            "filePath": "theme.js"
          }
        }
      ]
    }
  ]
}This parser helps you generate Style Dictionary raw token files for all your design tokens coming from Specify.
Unlike the existing to-style-dictionary parser, this one doesn't have any options yet.
interface parser {
  name: 'to-style-dictionary';
  output: {
    type: 'directory';
    directoryPath: string;
  };
}A collection will generate a folder at the top level
The default level refers to the SDTF Token Type associated SD Category → {collectionName?}/{SDCategory}
The next folder level is the name of the potential first group containing the token → {collectionName?}/{SDCategory}/{1stLevelGroupName?}
The default filename is the name of the first group, or the name of the each mode the token might have, or base.json → {collectionName?}/{SDCategory}/{ mode? | 1stLevelGroupName? | base}.json (priority order for filename: groupName > mode > base)
The token path inside the file must match the token file path with the following priority order: collection > SDCategoryType > Mode > Groups
{collectionName?}/{SDCategory}/{1stLevelGroupName? | mode? | base}.json → { collection: {type: {mode: { groupName: { tokenName: ... }}}}
{
  "colors": {
    "$collection": { "$modes": ["light", "dark"] },
    "core": {
      "blue-100": {
        "$type": "color",
        "$description": "token 1 aliased with n modes within collection within n groups",
        "$value": {
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 255,
            "model": "rgb"
          },
          "dark": {
            "red": 229,
            "blue": 29,
            "alpha": 1,
            "green": 29,
            "model": "rgb"
          }
        }
      },
      "blue-700": {
        "$type": "color",
        "$description": "token 2 aliased with n modes within collection within n groups",
        "$value": {
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 200,
            "model": "rgb"
          },
          "dark": {
            "red": 229,
            "blue": 0,
            "alpha": 1,
            "green": 0,
            "model": "rgb"
          }
        }
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$description": "alias token with n modes within collection within n groups",
              "$value": {
                "dark": {
                  "$mode": "dark",
                  "$alias": "colors.core.blue-100"
                },
                "light": {
                  "$mode": "light",
                  "$alias": "colors.core.blue-700"
                }
              }
            }
          }
        }
      }
    }  
  }
}
{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Generate Style Dictionary raw token files",
      "parsers": [
        {
          "name": "to-style-dictionary",
          "output": {
            "type": "directory",
            "directoryPath": "output/tokens/"
          }
        }
      ]
    }
  ]
}{
  "colors": {
    "color": {
      "light": {
        "core": {
          "blue-100": {
            "value": "rgb(255, 255, 255)",
            "type": "color",
            "description": "token 1 aliased with n modes within collection within n groups"
          },
          "blue-700": {
            "value": "rgb(255, 200, 255)",
            "type": "color",
            "description": "token 2 aliased with n modes within collection within n groups"
          }
        }
      }
    }
  }
}{
  "colors": {
    "color": {
      "dark": {
        "core": {
          "blue-100": {
            "value": "rgb(229, 29, 29)",
            "type": "color",
            "description": "token 1 aliased with n modes within collection within n groups"
          },
          "blue-700": {
            "value": "rgb(229, 0, 0)",
            "type": "color",
            "description": "token 2 aliased with n modes within collection within n groups"
          }
        }
      }
    }
  }
}{
  "colors": {
    "color": {
      "light": {
        "semantic": {
          "background": {
            "button": {
              "primary": {
                "hover": {
                  "value": "{colors.color.light.core.blue-700}",
                  "type": "color",
                  "description": "alias token with n modes within collection within n groups"
                }
              }
            }
          }
        }
      }
    }
  }
}npm install @specifyapp/cli yarn global add @specifyapp/cli{
  "version": "2",
  "repository": "@organization/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "CSS Styles",
      "parsers": [
        {
          "name": "to-css-custom-properties",
          "output": {
            "type":"file",
            "filePath": "style.css"
          }
        }
      ]
    },
    {
      "name": "Raw SDTF",
      "parsers": [
        {
          "name": "to-sdtf",
          "output": {
            "type":"file",
            "filePath": "raw.json"
          }
        }
      ]
    }
  ]
}:root[data-Colors="Dark"] {
  --Core-Label-blue-base: rgb(96, 168, 250);
  --Aliases-Icon-info: var(--Core-Label-blue-base);
  --Core-Label-red-base: rgb(221, 72, 64);
  --Aliases-Icon-error: var(--Core-Label-red-base);
  --Core-Neutral-neutral-6: rgb(174, 178, 183);
  --Aliases-Icon-default: var(--Core-Neutral-neutral-6);
  --Core-Label-green-base: rgb(125, 216, 121);
  --Aliases-Icon-success: var(--Core-Label-green-base);
  --Core-Label-orange-base: rgb(255, 158, 41);
  --Aliases-Icon-warning: var(--Core-Label-orange-base);
  --Core-Neutral-neutral-3: rgb(68, 71, 75);
  --Aliases-Icon-disabled: var(--Core-Neutral-neutral-3);
  --Core-Primary-app-base: rgb(98, 77, 227);
  --Aliases-Icon-selected: var(--Core-Primary-app-base);
}
:root[data-Dimensions="Mobile"] {
  --Base-dimension-02: 2px;
  --Radii-radius-01: var(--Base-dimension-02);
  --Base-dimension-08: 8px;
  --Radii-radius-02: var(--Base-dimension-08);
  --Base-dimension-04: 4px;
  --Base-dimension-12: 12px;
  --Base-dimension-16: 16px;
  --Base-dimension-24: 24px;
  --Base-dimension-32: 32px;
  --Spacings-spacing-01: var(--Base-dimension-02);
  --Spacings-spacing-02: var(--Base-dimension-04);
  --Spacings-spacing-03: var(--Base-dimension-12);
  --Spacings-spacing-04: var(--Base-dimension-16);
}
:root[data-Dimensions="Desktop"] {
  --Base-dimension-02: 2px;
  --Radii-radius-01: var(--Base-dimension-02);
  --Base-dimension-08: 8px;
  --Radii-radius-02: var(--Base-dimension-08);
  --Base-dimension-04: 4px;
  --Base-dimension-12: 12px;
  --Base-dimension-16: 16px;
  --Base-dimension-24: 24px;
  --Base-dimension-32: 32px;
  --Spacings-spacing-01: var(--Base-dimension-04);
  --Spacings-spacing-02: var(--Base-dimension-08);
  --Spacings-spacing-03: var(--Base-dimension-12);
  --Spacings-spacing-04: var(--Base-dimension-16);
}This parser helps you convert units of dimension tokens.
interface parser {
  name: 'convert-dimension';
  options: {
    toFormat: '%' | 'px' | 'em' | 'rem' | 'pt' | 'pc' | 'in' | 'cm' | 'mm' | 'ex' | 'cap' | 'ch' | 'ic' | 'lh' | 'rlh' | 'vw' | 'svw' | 'lvw' | 'dvw' | 'vh' | 'svh' | 'lvh' | 'dvh' | 'vi' | 'svi' | 'lvi' | 'dvi' | 'vb' | 'svb' | 'lvb' | 'dvb' | 'vmin' | 'svmin' | 'lvmin' | 'dvmin' | 'vmax' | 'svmax' | 'lvmax' | 'dvmax'
    baseValue?: {
      rem?: number
    }
    applyTo?: SDTFQuery,
  };
}toFormat
required
The target color format to convert to. Actual value conversion is done by the package.
baseValue
optional
applyTo
optional
The selection where to apply the transformation.
collection, group, token take a Regex string or true to select anything of the kind.
An SDTFQuery can be used for advance use cases. Learn more about .
{
  "Foundation": {
    "spacing": {
      "1": {
        "$type": "dimension",
        "$value": {
          "default": {
            "value": 4,
            "unit": "px"
          }
        }
      },
      "2": {
        "$type": "dimension",
        "$value": {
          "default": {
            "value": 8,
            "unit": "px"
          }
        }
      },
      "3": {
        "$type": "dimension",
        "$value": {
          "default": {
            "value": 12,
            "unit": "px"
          }
        }
      }
    }
  }
}We convert all colors from our SDTF graph in hsl.
We then generate our transformed SDTF graph in a JSON file thanks to the to-sdtf parser.
{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Convert spacing in rem and generate tokens in JSON",
      "parsers": [
        {
          "name": "convert-dimension",
          "options": {
            "toFormat": "rem"
          }
        },
        {
          "name": "to-sdtf",
          "output": {
            "type": "file",
            "filePath": "tokens.json"
          }
        }
      ]
    }
  ]
}{
  "Foundation": {
    "spacing": {
      "1": {
        "$type": "dimension",
        "$value": {
          "default": {
            "value": 0.25,
            "unit": "rem"
          }
        }
      },
      "2": {
        "$type": "dimension",
        "$value": {
          "default": {
            "value": 0.5,
            "unit": "rem"
          }
        }
      },
      "3": {
        "$type": "dimension",
        "$value": {
          "default": {
            "value": 0.75,
            "unit": "rem"
          }
        }
      }
    }
  }
}This template is dedicated for Web developers using CSS. It helps you generate all types of design tokens as CSS Custom Properties in their respective CSS file.
This example uses four different parsers:
to target on a specific collection named "Colors" that contains our colors
to convert our colors in HSL
to change the name of our tokens and modes to kebabCase
to generate a CSS file containing our tokens
This template is an example among others. Head toward the page to get all available options.
When using the CLI, you need to fill three properties:
repository  is @organization/repository
personalAccessToken which you can generate  
rules lets you transform tokens by chaining parsers
If you use the GitHub, you need to fill two properties:
repository  is @organization/repository
rules lets you transform tokens by chaining parsers
| '%' 
| 'px' 
| 'em' 
| 'rem' 
| 'pt' 
| 'pc' 
| 'in' 
| 'cm' 
| 'mm' 
| 'ex' 
| 'cap' 
| 'ch' 
| 'ic' 
| 'lh' 
| 'rlh' 
| 'vw' 
| 'svw' 
| 'lvw' 
| 'dvw' 
| 'vh' 
| 'svh' 
| 'lvh' 
| 'dvh' 
| 'vi' 
| 'svi' 
| 'lvi' 
| 'dvi' 
| 'vb' 
| 'svb' 
| 'lvb' 
| 'dvb' 
| 'vmin' 
| 'svmin' 
| 'lvmin' 
| 'dvmin' 
| 'vmax' 
| 'svmax' 
| 'lvmax' 
| 'dvmax'{ rem: number }| { collection: string | true }
| { group: string | true }
| { token: string | true }
| SDTFQuery{ token: true }{
  "version": "2",
  "repository": "@organization/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "css",
      "parsers": [
        {
          "name": "filter",
          "options": {
            "query": {
              "where": {
                "collection": "Colors",
                "select": {
                  "parents": true,
                  "children": true
                }
              }
            }
          }
        },
        {
          "name": "convert-color",
          "options": {
            "toFormat": "hsl",
            "applyTo": {
              "collection": true
            }
          }
        },
        {
          "name": "change-case",
          "options": {
            "change": "names",
            "toCase": "kebabCase",
            "applyTo": {
              "collection": true
            }
          }
        },
        {
          "name": "change-case",
          "options": {
            "change": "modes",
            "toCase": "kebabCase",
            "applyTo": {
              "collection": true
            }
          }
        },
        {
          "name": "to-css-custom-properties",
          "output": {
            "type": "file",
            "filePath": "tokens.css"
          }
        }
      ]
    }
  ]
}{
  "version": "2",
  "repository": "@organization/repository",
  "rules": [
    {
      "name": "css",
      "parsers": [
        {
          "name": "filter",
          "options": {
            "query": {
              "where": {
                "collection": "Colors",
                "select": {
                  "parents": true,
                  "children": true
                }
              }
            }
          }
        },
        {
          "name": "convert-color",
          "options": {
            "toFormat": "hsl",
            "applyTo": {
              "collection": true
            }
          }
        },
        {
          "name": "change-case",
          "options": {
            "change": "names",
            "toCase": "kebabCase",
            "applyTo": {
              "collection": true
            }
          }
        },
        {
          "name": "change-case",
          "options": {
            "change": "modes",
            "toCase": "kebabCase",
            "applyTo": {
              "collection": true
            }
          }
        },
        {
          "name": "to-css-custom-properties",
          "output": {
            "type": "file",
            "filePath": "tokens.css"
          }
        }
      ]
    }
  ]
}interface parser {
  name: 'to-react-native';
  output: {
    type: 'file';
    filePath: string;
  };
  options?: {
    typescript?: boolean;
    moduleExport?: 'es6' | 'commonjs';
  };
}{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "To React Native theme",
      "parsers": [
        {
          "name": "to-react-native",
          "output": {
            "type": "file",
            "filePath": "public/theme.js"
          }
        }
      ]
    }
  ]
}/** 
* @typedef {'primitive.spacing.1'} DimensionPath - All the valid paths for the tokens of type dimension.
* To use this type you can do: `@type {import('path/to/myTokensFile').DimensionPath}`
*/
/** 
* @typedef {'themedColor.highEmphasis'} ColorPath - All the valid paths for the tokens of type color.
* To use this type you can do: `@type {import('path/to/myTokensFile').ColorPath}`
*/
/**
* @typedef {DimensionPath | ColorPath} AllPath - All possible paths
*/
/**
* @typedef {typeof pathsByType} PathsByType - All the paths for a given token type. Needed for `getTokensByType`
*/
const pathsByType = /** @type {const} */ ({
  dimension: [ 'primitive.spacing.1' ],
  color: [ 'themedColor.highEmphasis' ]
});
/**
* @typedef {typeof colorModes[number]} ColorModes - All the valid modes of color.
* To use this type you can do: `@type {import('path/to/myTokensFile').ColorModes}`
*/
export const colorModes = /** @type {const} */ ([ 'dark', 'light' ]);
/**
* @typedef {typeof themedColorModes[number]} ThemedcolorModes - All the valid modes of themedColor.
* To use this type you can do: `@type {import('path/to/myTokensFile').ThemedcolorModes}`
*/
export const themedColorModes = /** @type {const} */ ([ 'light', 'dark' ]);
/**
@typedef {ColorModes | ThemedcolorModes} AllMode - All the available modes
*/
/** 
* @typedef {typeof tokens} Tokens - All the tokens. 
* Use `getTokenByMode` to retrieve one. 
*/
export const tokens = /** @type {const} */ ({
  'primitive.spacing.1': '4px',
  'themedColor.highEmphasis': { dark: '#ffffff', light: '#000000' }
});
/**
* Retrieve any token for a given mode. If available, the default mode will be: 'default'
* @template {AllPath} Path - A generic extending all the possible paths
* @template {Tokens[Path] extends Record<string, any>
    ? keyof Tokens[Path]
    : undefined} Mode - A generic representing all the valid modes for a given path
* @template {Tokens[Path] extends Record<string, any>
    ? Tokens[Path][Mode extends undefined ? never : Mode]
    : Tokens[Path]} Return - The return type
* @param {Path} path - The path to the token
* @param {Mode} mode - The mode of the token you want to retrieve 
* @returns {Return} - The value of a token for a given mode
*/
export function getTokenByMode(path, mode) {
  if (!tokens[path]) {
    throw new Error("Path: '" + path + "' doesn't exist. Here are all the valid paths:\n- " + Object.keys(tokens).join('\n- '))
  }
  if (typeof tokens[path] !== 'object') {
    return tokens[path] ;
  }
  if (!mode) throw new Error('Mode is undefined but it should be one of ' + Object.keys(tokens[path]).join(', ') + ' for path: ' + path);
  if (!tokens[path][mode]) {
    throw new Error("Invalid mode '" + mode.toString() + " at path '" + path + "', here are all the valid modes:\n- " + Object.keys(tokens[path]).join('\n- '))
  } 
  return tokens[path][mode]  
}
/**
* Retrieve all the tokens for a specific type (color, dimension, etc...).
* Note that the value will either be a string or an object if the token has modes
* @template {keyof PathsByType} Type - A generic extending all the possible types
* @template {Tokens[PathsByType[Type][number]]} Token - A generic representing a union of all the outputs
* @param {Type} type - The path to the token
* @returns {Array<Token>} - An array with all the values
*/
export function getTokensByType(type) {
  if (!pathsByType[type]) {
    throw new Error('The type: \'' + type + '\' does not exist')
  }
  return pathsByType[type].map(path => tokens[path]);
}{
  "colors": {
    "$collection": {
      "$modes": [
        "light",
        "dark"
      ]
    },
    "Core": {
      "blue-100": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 29,
            "alpha": 1,
            "green": 29,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 255,
            "model": "rgb"
          }
        },
        "$description": "token 1 aliased with n modes within collection within n groups"
      },
      "blue-700": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 0,
            "alpha": 1,
            "green": 0,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 200,
            "model": "rgb"
          }
        },
        "$description": "token 2 aliased with n modes within collection within n groups"
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$value": {
                "dark": {
                  "$mode": "dark",
                  "$alias": "colors.Core.blue-100"
                },
                "light": {
                  "$mode": "light",
                  "$alias": "colors.Core.blue-700"
                }
              },
              "$description": "alias token with n modes within collection within n groups"
            }
          }
        }
      }
    }
  }
}interface parser {
  name: 'to-javascript';
  output: {
    type: 'file';
    filePath: string;
  };
  options?: {
    typescript?: boolean;
    moduleExport?: 'es6' | 'commonjs';
  };
}{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "To JavaScript",
      "parsers": [
        {
          "name": "to-javascript",
          "output": {
            "type": "file",
            "filePath": "tokens.js"
          }
        }
      ]
    }
  ]
}/** 
* @enum {string} All the valid paths for the collection colors.
* Use it when calling `getColorsTokenByMode`
*/
export const colorsColorPath = {
  'colors.Core.blue-100': 'colors.Core.blue-100',
  'colors.Core.blue-700': 'colors.Core.blue-700',
  'colors.semantic.background.button.primary.hover': 'colors.semantic.background.button.primary.hover'
};
/**
* All the modes of the collection colors.
* Use it when calling `getColorsTokenByMode`
*/
export const colorsModes = [ 'light', 'dark' ];
/** 
* All the tokens of the collection colors.
* Use `getColorsTokenByMode` to retrieve the tokens
*/
export const colors = {
  'colors.Core.blue-100': { dark: 'rgb(229, 29, 29)', light: 'rgb(255, 255, 255)' },
  'colors.Core.blue-700': { dark: 'rgb(229, 0, 0)', light: 'rgb(255, 200, 255)' },
  'colors.semantic.background.button.primary.hover': { dark: 'rgb(229, 29, 29)', light: 'rgb(255, 200, 255)' }
};
/**
* Retrieve a token for the collection 'colors'.
* @param {keyof typeof colorsPath} path - The path to the token
* @param {'light' | 'dark'} mode - The mode of the token you want to retrieve 
* @returns {number | string} The value of a token for a given mode
*/
export function getColorsTokenByMode(path, mode) {
  if (!colors[path]) {
    throw new Error("Path: '" + path + "' doesn't exist for collection 'colors'. Here are all the valid paths for each type:" + `
- color:
    - colors.Core.blue-100
    - colors.Core.blue-700
    - colors.semantic.background.button.primary.hover`)
  }
  if (!colors[path][mode]) {
    throw new Error("Invalid mode '" + mode.toString() + "' for collection 'colors' at path '" + path + "', here are all the valid modes:\n- " + Object.keys(colors[path]).join('\n- '))
  }
  return colors[path][mode]
}{
  "colors": {
    "$collection": {
      "$modes": [
        "light",
        "dark"
      ]
    },
    "Core": {
      "blue-100": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 29,
            "alpha": 1,
            "green": 29,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 255,
            "model": "rgb"
          }
        },
        "$description": "token 1 aliased with n modes within collection within n groups"
      },
      "blue-700": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 0,
            "alpha": 1,
            "green": 0,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 200,
            "model": "rgb"
          }
        },
        "$description": "token 2 aliased with n modes within collection within n groups"
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$value": {
                "dark": {
                  "$mode": "dark",
                  "$alias": "colors.Core.blue-100"
                },
                "light": {
                  "$mode": "light",
                  "$alias": "colors.Core.blue-700"
                }
              },
              "$description": "alias token with n modes within collection within n groups"
            }
          }
        }
      }
    }
  }
}This parser helps you filter a SDTF graph.
interface parser {
  name: 'filter';
  options: {
    query: SDTFQuery;
    resolveAliases?: boolean;
    allowUnresolvableAliases?: boolean;
    deduplicate: true | undefined;
    failOnMutate: true | undefined;
  };
}query
required
SDTFQuery
The query that select items in the graph. Learn more about .
resolveAliases
optional
boolean
false
Whether to resolve the aliases of the graph. Thus, preventing aliases to become unresolvable when their source is not included in the selected items.
allowUnresolvableAliases
optional
boolean
true
Whether to allow unresolvable aliases to flow through. 
This option is only available when resolveAliases = true
deduplicate
optional
true | undefined
undefined
When you target tokens from different areas in your graph you can end up with tokens that will have the same name which will lead to an override. When set to true, this option will suffix tokens with a -{number} to prevent the override.
failOnMutate
optional
true | undefined
undefined
By default, this parser mutates your graph. When set to true this option will make your pipeline return an error when your tokens respective path differ from their original one in the graph. Set this option to true if you want to be 100% aligned between design and code.
{
  "colors": {
    "$collection": {
      "$modes": ["light", "dark"]
    },
    "info": {
      "infoToken": {
        "$type": "color",
        "$value": {
          "light": {
            "model": "rgb",
            "red": 219,
            "green": 234,
            "blue": 254,
            "alpha": 1
          },
          "dark": {
            "model": "rgb",
            "red": 219,
            "green": 234,
            "blue": 254,
            "alpha": 1
          }
        }
      }
    },
    "danger": {
      "dangerToken": {
        "$type": "color",
        "$value": {
          "light": {
            "model": "rgb",
            "red": 209,
            "green": 204,
            "blue": 204,
            "alpha": 1
          },
          "dark": {
            "model": "rgb",
            "red": 19,
            "green": 34,
            "blue": 54,
            "alpha": 1
          }
        }
      }
    }
  }
}We want to get all tokens in all groups named "info"
We also want to get the parent collection...
... and all children tokens within the "info" group(s)
We eventually generate our transformed SDTF graph in a JSON file thanks to the to-sdtf parser.
{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Only get tokens from a group named 'info' and gererate tokens in JSON",
      "parsers": [
        {
          "name": "filter",
          "options": {
            "query": {
              "where": {
                "group": "info",
                "select": {
                  "parents": true,
                  "children": true
                }
              }
            }
          }
        },
        {
          "name": "to-sdtf",
          "output": {
            "type": "file",
            "filePath": "tokens.json"
          }
        }
      ]
    }
  ]
}{
  "colors": {
    "$collection": {
      "$modes": ["light", "dark"]
    },
    "info": {
      "infoToken": {
        "$type": "color",
        "$value": {
          "light": {
            "model": "rgb",
            "red": 219,
            "green": 234,
            "blue": 254,
            "alpha": 1
          },
          "dark": {
            "model": "rgb",
            "red": 219,
            "green": 234,
            "blue": 254,
            "alpha": 1
          }
        }
      }
    }
  }
}In this guide you’ll learn how to sync your design tokens from Tokens Studio to your Specify repository and how to keep them updated.
To get the most out of this guide, you will need:
A account
The plugin installed in your Figma
A , , , or account
Specify automatically fetches design tokens through the JSON file created by Tokens Studio. The best way to keep your design tokens in sync with both tools is to host your JSON file in a repository like GitHub.
Head to your Tokens Studio plugin in Figma
Within the settings tab, add a new sync provider
Commit your Tokens Studio JSON file to your repository
Go to your Specify workspace
Click on "Create repository"
Choose "Advanced Repository"
Name your repository
Select "Sync from Figma Variables & Tokens Studio" ()
Click on "Create repository"
In the "Source" tab, click on "Create a source"
Select "Remote URL"
At this point, you have two ways to sync your JSON file. Either with a public hosting link or a private one. We will go through both options below.
In the "Source" tab, click on "Create a source"
Select "Remote URL"
Select "Public"
Name your source
Paste your raw public URL of your JSON file
Select the format "Tokens Studio"
Let Specify check the connection
And voila!
Your JSON file is now detected as a source and your design tokens appear within your repository.
On the opposite of the public URL, Specify will ask you for some additional information so its system is able to fetch your file. Let’s see how to proceed with the main versioning tools:
Requirements:
Have a GitHub account
Have an Advanced Repository created
Have a JSON file containing design tokens from Tokens Studio
To add a private URL source from GitHub to Specify:
In the "Source" tab of your Specify repository, click on "Create a source"
Select "Remote URL"
Select "Private"
Name your source
Create and Paste this GitHub file URL such as: https://api.github.com/repos///contents/
Select "Bearer Token" as the auth system & paste your personal access token from GitHub ( and be sure to check the repo section)
Select "Tokens Studio Format"
Specify will test your JSON
And voila!
Requirements:
Have an Azure DevOps account
Have a Project containing a repository
Have a JSON file containing design tokens from Tokens Studio
To add a private URL source from Azure DevOps to Specify:
In the "Source" tab of your Specify repository, click on "Create a source"
Select "Remote URL"
Select "Private"
Name your source
Paste your Azure DevOps file URL such as https://dev.azure.com/{OrgName}/{ProjectName}/_apis/git/repositories/{RepositoryName}/items?path={FilePath}&api-version=7.0&includeContent=true
Select "Basic Auth" as auth system. Use your Azure DevOps email and a new Azure DevOps personal access token with Full Access or Code -> Read permissions.
Select "Tokens Studio Format"
Specify will test your JSON
And voila!
Requirements:
Have a GitLab account
Have an Advanced Repository created
Have a JSON file containing design tokens from Tokens Studio
To add a private URL source from GitLab to Specify:
In the "Source" tab of your Specify repository, click on "Create a source"
Select "Remote URL"
Select "Private"
Give a name to your source
Paste your GitLab file URL such as: https://gitlab.com/api/v4/projects/{OrgName}%2F{RepositoryName}/repository/files/{FilePath}?ref={branch}
Create an access token in GitLab: "Settings > Access Tokens". Select a role as Developer or Owner and select the scopes of read_api and read_repository.
In Specify, select Header as auth system
Fill PRIVATE-TOKEN in the key field
Paste your GitLab project access token
Select "Tokens Studio Format"
Specify will test your JSON
And voila!
Requirements:
Have a JSONBin account
Have an Advanced Repository created
Have a bin with a JSON file containing design tokens from Tokens Studio
To add a private URL source from JSONBin to Specify:
In the "Source" tab of your Specify repository, click on "Create a source"
Select "Remote URL"
Select "Private"
Name your source
Paste your BIN private URL such as https://api.jsonbin.io/v3/b/{bin_id}
Select Header as auth system
Depending on your choice, you can use your master key or an access key.  on JSONBin.
Following your choice, fill in the key field either with X-MASTER-KEY or X-ACCESS-KEY
Paste your key in the value field
Select "Tokens Studio Format"
Specify will test your JSON
And voila!
After adding your source. All you have to do is to:
Go to the "Source" tab of your Specify repository
Click on the context menu next to your source
Click on "sync"
Your source is now updated!
Please keep in mind Specify is yet not compatible with the following data coming from Tokens Studio:
Composition
Assets (bitmap & vectors)
Color manipulation (gradients, alpha, darken, lighten & mix)
They will be released in future updates. However, if you have urgent needs for Specify to be compatible with one of them, .
interface parser {
  name: 'convert-color';
  options: {
    toFormat:
      | 'hex'
      | 'rgb'
      | 'hsl'
      | 'hsb'
      | 'lch'
      | 'lab';
    applyTo?:
      | { collection: string | true }
      | { group: string | true }
      | { token: string | true }
      | SDTFQuery;
  };
}toFormat
required
| 'hex' 
| 'rgb' 
| 'hsl' 
| 'hsb' 
| 'lch' 
| 'lab'The target color format to convert to. Actual value conversion is done by the colord package.
applyTo
optional
| { collection: string | true }
| { group: string | true }
| { token: string | true }
| SDTFQuery{ token: true }The selection where to apply the transformation.
collection, group, token take a Regex string or true to select anything of the kind.
An SDTFQuery can be used for advance use cases. Learn more about how to query your SDTF graph.
{
  "Colors": {
    "$collection": { "$modes": ["Light", "Dark"] },
    "Core": {
      "blue 100": {
        "$type": "color",
        "$description": "token 1 aliased with n modes within collection within n groups",
        "$value": {
          "Light": {
            "red": 219,
            "blue": 254,
            "alpha": 1,
            "green": 236,
            "model": "rgb"
          },
          "Dark": {
            "red": 41,
            "blue": 67,
            "alpha": 1,
            "green": 52,
            "model": "rgb"
          }
        }
      },
      "blue 700": {
        "$type": "color",
        "$description": "token 2 aliased with n modes within collection within n groups",
        "$value": {
          "Light": {
            "red": 17,
            "blue": 249,
            "alpha": 1,
            "green": 125,
            "model": "rgb"
          },
          "Dark": {
            "red": 96,
            "blue": 250,
            "alpha": 1,
            "green": 168,
            "model": "rgb"
          }
        }
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$description": "alias token with n modes within collection within n groups",
              "$value": {
                "Dark": {
                  "$mode": "dark",
                  "$alias": "Colors.Core.blue 100"
                },
                "Light": {
                  "$mode": "light",
                  "$alias": "Colors.Core.blue 700"
                }
              }
            }
          }
        }
      }
    }  
  }
}{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Convert colors in HSL and generate tokens in JSON",
      "parsers": [
        {
          "name": "convert-color",
          "options": {
            "toFormat": "hsl"
          }
        },
        {
          "name": "to-sdtf",
          "output": {
            "type": "file",
            "filePath": "tokens.json"
          }
        }
      ]
    }
  ]
}{
  "colors": {
    "$collection": { "$modes": ["light", "dark"] },
    "core": {
      "blue-100": {
        "$type": "color",
        "$description": "token 1 aliased with n modes within collection within n groups",
        "$value": {
          "light": {
            "model": "hsl",
            "hue": 211,
            "saturation": 95,
            "lightness": 93,
            "alpha": 1
          },
          "dark": {
            "model": "hsl",
            "hue": 215,
            "saturation": 24,
            "lightness": 21,
            "alpha": 1
          }
        }
      },
      "blue-700": {
        "$type": "color",
        "$description": "token 2 aliased with n modes within collection within n groups",
        "$value": {
          "light": {
            "model": "hsl",
            "hue": 212,
            "saturation": 95,
            "lightness": 52,
            "alpha": 1
          },
          "dark": {
            "model": "hsl",
            "hue": 212,
            "saturation": 94,
            "lightness": 68,
            "alpha": 1
          }
        }
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$description": "alias token with n modes within collection within n groups",
              "$value": {
                "dark": {
                  "$mode": "dark",
                  "$alias": "colors.core.blue-100"
                },
                "light": {
                  "$mode": "light",
                  "$alias": "colors.core.blue-700"
                }
              }
            }
          }
        }
      }
    }  
  }
}
Learn more about how to query your SDTF token graph.
Your token system can be more complex than it seems. You will often need to interact with your token graph to transform a specific set of design tokens within a Specify configuration.
This article will help you understand how you can query your token graph to select a specific set of tokens.
You'll need to query your graph when using the following parsers:
Every Query holds a single a where property being an object, to select one branch of the graph, or an array of objects, to select many branches of the graph (OR statement).
The where property splits in 3 kinds: token, group, collection - offering a dedicated set of options to match against the given kind.
The name property accepts a RegExp for a value. These resources will help you debug your regular expressions:
Type Query = { where: Where | Array<Where> }type WhereToken = {
  token: 
    | string
    | {
      name?: string;
      description?: string?;
    }
  select: 
    | true
    | {
      token?: boolean;
      parents?:
        | true
        | {
          groups?: true;
          collections?: true;
        }
    }
}type WhereGroup = {
  group: string;
  select: 
    | true
    | {
      group?: boolean;
      parents?:
        | true
        | {
          groups?: true;
          collections?: true;
        }
      children:
        | true
        | {
          groups?: true;
          collections?: true;
          tokens?: true;
        }
    }
}type WhereCollection = {
  collection: string;
  select: 
    | true
    | {
      collection?: boolean;
      parents?:
        | true
        | {
          groups?: true;
        }
      children:
        | true
        | {
          groups?: true;
          tokens?: true;
        }
    }
}{
  "version": "2",
  "repository": "@organization/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Get tokens from collection named 'Colors'",
      "parsers": [
        {
          "name": "filter",
          "options": {
            "query": {
              "where": {
                "collection": "^Colors$",
                "select": {
                  "parents": true,
                  "children": true
                }
              }
            }
          }
        }
      ]
    }
  ]
}{
  "version": "2",
  "repository": "@organization/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Get tokens from all collections whose names contain 'colors'",
      "parsers": [
        {
          "name": "filter",
          "options": {
            "where": {
              "collection": "colors",
              "select": {
                "collection": true,
                "children": {
                  "tokens": true
                }
              }
            }
          }
        }
      ]
    }
  ]
}{
  "version": "2",
  "repository": "@organization/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Get tokens from all groups named 'brand'",
      "parsers": [
        {
          "name": "filter",
          "options": {
            "query": {
              "where": {
                "group": "^brand$",
                "select": {
                  "parents": true,
                  "children": true
                }
              }
            }
          }
        }
      ]
    }
  ]
}{
  "version": "2",
  "repository": "@organization/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Get color tokens from the 'Android' collection",
      "parsers": [
        {
          "name": "filter",
          "options": {
            "where": {
              "collection": "^Android$",
              "andWhere": {
                "token": ".*",
                "withTypes": { "include": ["color"] },
                "select": {
                  "token": true,
                  "parents": {
                    "collections": true
                  }
                }
              }
            }
          }
        }
      ]
    }
  ]
}{
  "version": "2",
  "repository": "@organization/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Get color tokens from the 'Android' collection and from all groups named 'components'",
      "parsers": [
        {
          "name": "filter",
          "options": {
            "where": {
              "collection": "^Android$",
              "andWhere": {
                "group": "^components$",
                "andWhere": {
                  "token": ".*",
                  "withTypes": {
                    "include": ["color"]
                  },
                  "select": {
                    "token": true,
                    "parents": true
                  }
                }
              }
            }
          }
        }
      ]
    }
  ]
}{
  "version": "2",
  "repository": "@organization/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Get tokens from the group named 'Components' and/or from the group named 'Semantic'",
      "parsers": [
        {
          "name": "filter",
          "options": {
            "where": {
              "collection": "^Android$",
              "andWhere": {
                "group": "^Components$|^Semantic$",
                "andWhere": {
                  "token": ".*",
                  "select": {
                    "token": true,
                    "parents": true
                  }
                }
              }
            }
          }
        }
      ]
    }
  ]
}This parser helps you pull design tokens in JSON with token values in JSON or CSS.
interface parser {
  name: 'to-json';
  output: {
    type: 'file';
    filePath: string;
  };
  options?: {
    output?: 'raw' | 'css';
  };
}{
  "colors": {
    "$collection": {
      "$modes": [
        "light",
        "dark"
      ]
    },
    "Core": {
      "blue-100": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 29,
            "alpha": 1,
            "green": 29,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 255,
            "model": "rgb"
          }
        },
        "$description": "token 1 aliased with n modes within collection within n groups"
      },
      "blue-700": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 0,
            "alpha": 1,
            "green": 0,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 200,
            "model": "rgb"
          }
        },
        "$description": "token 2 aliased with n modes within collection within n groups"
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$value": {
                "dark": {
                  "$mode": "dark",
                  "$alias": "colors.Core.blue-100"
                },
                "light": {
                  "$mode": "light",
                  "$alias": "colors.Core.blue-700"
                }
              },
              "$description": "alias token with n modes within collection within n groups"
            }
          }
        }
      }
    }
  }
}{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "To JSON",
      "parsers": [
        {
          "name": "to-json",
          "output": {
            "type": "file",
            "filePath": "tokens.json"
          }
        }
      ]
    }
  ]
}{
  "colors": {
    "Core": {
      "blue-100": {
        "dark": {
          "model": "rgb",
          "red": 229,
          "green": 29,
          "blue": 29,
          "alpha": 1
        },
        "light": {
          "model": "rgb",
          "red": 255,
          "green": 255,
          "blue": 255,
          "alpha": 1
        }
      },
      "blue-700": {
        "dark": {
          "model": "rgb",
          "red": 229,
          "green": 0,
          "blue": 0,
          "alpha": 1
        },
        "light": {
          "model": "rgb",
          "red": 255,
          "green": 200,
          "blue": 255,
          "alpha": 1
        }
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "dark": {
                "model": "rgb",
                "red": 229,
                "green": 29,
                "blue": 29,
                "alpha": 1
              },
              "light": {
                "model": "rgb",
                "red": 255,
                "green": 200,
                "blue": 255,
                "alpha": 1
              }
            }
          }
        }
      }
    }
  }
}{
  "colors": {
    "$collection": {
      "$modes": [
        "light",
        "dark"
      ]
    },
    "Core": {
      "blue-100": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 29,
            "alpha": 1,
            "green": 29,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 255,
            "model": "rgb"
          }
        },
        "$description": "token 1 aliased with n modes within collection within n groups"
      },
      "blue-700": {
        "$type": "color",
        "$value": {
          "dark": {
            "red": 229,
            "blue": 0,
            "alpha": 1,
            "green": 0,
            "model": "rgb"
          },
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 200,
            "model": "rgb"
          }
        },
        "$description": "token 2 aliased with n modes within collection within n groups"
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$value": {
                "dark": {
                  "$mode": "dark",
                  "$alias": "colors.Core.blue-100"
                },
                "light": {
                  "$mode": "light",
                  "$alias": "colors.Core.blue-700"
                }
              },
              "$description": "alias token with n modes within collection within n groups"
            }
          }
        }
      }
    }
  }
}{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "To JSON",
      "parsers": [
        {
          "name": "to-json",
          "output": {
            "type": "file",
            "filePath": "tokens.json"
          },
          "options": {
            "output": "css"
          }
        }
      ]
    }
  ]
}{
  "colors": {
    "Core": {
      "blue-100": {
        "dark": "rgb(229, 29, 29)",
        "light": "rgb(255, 255, 255)"
      },
      "blue-700": {
        "dark": "rgb(229, 0, 0)",
        "light": "rgb(255, 200, 255)"
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "dark": "rgb(229, 29, 29)",
              "light": "rgb(255, 200, 255)"
            }
          }
        }
      }
    }
  }
}This parser helps you change the case of names or modes over a SDTF graph.
interface parser {
  name: 'change-case';
  options: {
    change?: 'name' | 'modes';
    toCase:
      | 'camelCase'
      | 'capitalCase'
      | 'constantCase'
      | 'kebabCase'
      | 'noCase'
      | 'pascalCase'
      | 'pascalSnakeCase'
      | 'pathCase'
      | 'sentenceCase'
      | 'snakeCase'
      | 'trainCase';
    applyTo:
      | { collection: string | true }
      | { group: string | true }
      | { token: string | true }
      | SDTFQuery;
  };
}change
optional
'names'
Change the names or the modes of the selected items.
toCase
required
The case transformation to apply. Actual transform is done by the package.
applyTo
required
The selection where to apply the transformation.
collection, group, token take a Regex string or true to select anything of the kind.
An SDTFQuery can be used for advance use cases. Learn more about .
This example helps you transform in kebabCase the name all collections, groups, tokens and modes. Use this example if you want to generate CSS Custom properties with the to-css-custom-properties parser.
{
  "Colors": {
    "$collection": { "$modes": ["Light", "Dark"] },
    "Core": {
      "blue 100": {
        "$type": "color",
        "$description": "token 1 aliased with n modes within collection within n groups",
        "$value": {
          "Light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 255,
            "model": "rgb"
          },
          "Dark": {
            "red": 229,
            "blue": 29,
            "alpha": 1,
            "green": 29,
            "model": "rgb"
          }
        }
      },
      "blue 700": {
        "$type": "color",
        "$description": "token 2 aliased with n modes within collection within n groups",
        "$value": {
          "Light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 200,
            "model": "rgb"
          },
          "Dark": {
            "red": 229,
            "blue": 0,
            "alpha": 1,
            "green": 0,
            "model": "rgb"
          }
        }
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$description": "alias token with n modes within collection within n groups",
              "$value": {
                "Dark": {
                  "$mode": "dark",
                  "$alias": "Colors.Core.blue 100"
                },
                "Light": {
                  "$mode": "light",
                  "$alias": "Colors.Core.blue 700"
                }
              }
            }
          }
        }
      }
    }  
  }
}We change the case of the token names and the modes to kebabCase. We applyTo the collection level so we transform in kebabCase:
the collection names
the group names
the token names
the mode names
We eventually generate our transformed SDTF graph in a JSON file thanks to the to-sdtf parser.
{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Format all token names and modes to kebabCase and generate tokens in JSON",
      "parsers": [
        {
          "name": "change-case",
          "options": {
            "change": "names",
            "toCase": "kebabCase",
            "applyTo": {
              "collection": true
            }
          }
        },
        {
          "name": "change-case",
          "options": {
            "change": "modes",
            "toCase": "kebabCase",
            "applyTo": {
              "collection": true
            }
          }
        },
        {
          "name": "to-sdtf",
          "output": {
            "type": "file",
            "filePath": "tokens.json"
          }
        }
      ]
    }
  ]
}{
  "colors": {
    "$collection": { "$modes": ["light", "dark"] },
    "core": {
      "blue-100": {
        "$type": "color",
        "$description": "token 1 aliased with n modes within collection within n groups",
        "$value": {
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 255,
            "model": "rgb"
          },
          "dark": {
            "red": 229,
            "blue": 29,
            "alpha": 1,
            "green": 29,
            "model": "rgb"
          }
        }
      },
      "blue-700": {
        "$type": "color",
        "$description": "token 2 aliased with n modes within collection within n groups",
        "$value": {
          "light": {
            "red": 255,
            "blue": 255,
            "alpha": 1,
            "green": 200,
            "model": "rgb"
          },
          "dark": {
            "red": 229,
            "blue": 0,
            "alpha": 1,
            "green": 0,
            "model": "rgb"
          }
        }
      }
    },
    "semantic": {
      "background": {
        "button": {
          "primary": {
            "hover": {
              "$type": "color",
              "$description": "alias token with n modes within collection within n groups",
              "$value": {
                "dark": {
                  "$mode": "dark",
                  "$alias": "colors.core.blue-100"
                },
                "light": {
                  "$mode": "light",
                  "$alias": "colors.core.blue-700"
                }
              }
            }
          }
        }
      }
    }  
  }
}'names' | 'modes'| 'camelCase'
| 'capitalCase'
| 'constantCase'
| 'kebabCase'
| 'noCase'
| 'pascalCase'
| 'pascalSnakeCase'
| 'pathCase'
| 'sentenceCase'
| 'snakeCase'
| 'trainCase'| { collection: string | true }
| { group: string | true }
| { token: string | true }
| SDTFQueryThis parser helps you generate a Tailwind theme from all your design tokens coming from Specify.
interface parser {
  name: 'to-tailwind';
  output: {
    type: 'file';
    filePath: string; // e.g theme.js
  };
  options?: {
    useCssVariable?: boolean;
    cssVariableTemplate?: {
      tokenNameTemplate?: string;
      tokenNotInCollectionNameTemplate?: string;
    }
  };
}{
  "colors": {
    "$collection": {
      "$modes": [
        "light",
        "dark"
      ]
    },
    "aliases": {
      "border": {
        "active": {
          "$type": "color",
          "$value": {
            "dark": {
              "$alias": "colors.core.label.blue-base",
              "$mode": "dark"
            },
            "light": {
              "$alias": "colors.core.label.blue-base",
              "$mode": "light"
            }
          }
        }
      }
    },
    "core": {
      "label": {
        "blue-base": {
          "$type": "color",
          "$value": {
            "dark": {
              "model": "rgb",
              "red": 96,
              "green": 168,
              "blue": 250,
              "alpha": 1
            },
            "light": {
              "model": "rgb",
              "red": 17,
              "green": 125,
              "blue": 249,
              "alpha": 1
            }
          }
        },
        "blue-lighter": {
          "$type": "color",
          "$value": {
            "dark": {
              "model": "rgb",
              "red": 41,
              "green": 52,
              "blue": 67,
              "alpha": 1
            },
            "light": {
              "model": "rgb",
              "red": 219,
              "green": 236,
              "blue": 254,
              "alpha": 1
            }
          }
        }
      }
    }
  },
  "dimensions": {
    "$collection": {
      "$modes": [
        "desktop",
        "mobile"
      ]
    },
    "base": {
      "dimension-01": {
        "$type": "dimension",
        "$value": {
          "mobile": {
            "value": 2,
            "unit": "px"
          },
          "desktop": {
            "value": 4,
            "unit": "px"
          }
        }
      },
      "dimension-02": {
        "$type": "dimension",
        "$value": {
          "mobile": {
            "value": 4,
            "unit": "px"
          },
          "desktop": {
            "value": 8,
            "unit": "px"
          }
        }
      }
    }
  }
}{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Generate tokens as a Tailwind theme",
      "parsers": [
        {
          "name": "to-tailwind",
          "output": {
            "type": "file",
            "filePath": "theme.js"
          }
        }
      ]
    }
  ]
}/** @type {import('tailwindcss').Config} */
module.exports = {
  theme: {
    extend: {
      colors: {
        colors: {
          core: {
            label: {
              'blue-lighter': {
                'dark': 'rgb(41, 52, 67)',
                'light': 'rgb(219, 236, 254)'
              },
              'blue-base': {
                'dark': 'rgb(96, 168, 250)',
                'light': 'rgb(17, 125, 249)'
              }
            }
          },
          aliases: {
            border: {
              active: {
                'dark': 'rgb(98, 77, 227)',
                'light': 'rgb(235, 33, 33)'
              }
            }
          }
        }
      },
      spacing: {
        'dimensions-base-dimension-01-desktop': '4px',
        'dimensions-base-dimension-01-mobile': '2px',
        'dimensions-base-dimension-02-desktop': '8px',
        'dimensions-base-dimension-02-mobile': '4px'
      }
    }
  }
}{
  "colors": {
    "$collection": {
      "$modes": [
        "light",
        "dark"
      ]
    },
    "aliases": {
      "border": {
        "active": {
          "$type": "color",
          "$value": {
            "dark": {
              "$alias": "colors.core.label.blue-base",
              "$mode": "dark"
            },
            "light": {
              "$alias": "colors.core.label.blue-base",
              "$mode": "light"
            }
          }
        }
      }
    },
    "core": {
      "label": {
        "blue-base": {
          "$type": "color",
          "$value": {
            "dark": {
              "model": "rgb",
              "red": 96,
              "green": 168,
              "blue": 250,
              "alpha": 1
            },
            "light": {
              "model": "rgb",
              "red": 17,
              "green": 125,
              "blue": 249,
              "alpha": 1
            }
          }
        },
        "blue-lighter": {
          "$type": "color",
          "$value": {
            "dark": {
              "model": "rgb",
              "red": 41,
              "green": 52,
              "blue": 67,
              "alpha": 1
            },
            "light": {
              "model": "rgb",
              "red": 219,
              "green": 236,
              "blue": 254,
              "alpha": 1
            }
          }
        }
      }
    }
  },
  "dimensions": {
    "$collection": {
      "$modes": [
        "desktop",
        "mobile"
      ]
    },
    "base": {
      "dimension-01": {
        "$type": "dimension",
        "$value": {
          "mobile": {
            "value": 2,
            "unit": "px"
          },
          "desktop": {
            "value": 4,
            "unit": "px"
          }
        }
      },
      "dimension-02": {
        "$type": "dimension",
        "$value": {
          "mobile": {
            "value": 4,
            "unit": "px"
          },
          "desktop": {
            "value": 8,
            "unit": "px"
          }
        }
      }
    }
  }
}{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Generate tokens as a Tailwind theme",
      "parsers": [
        {
          "name": "to-tailwind",
          "output": {
            "type": "file",
            "filePath": "theme.js"
          },
          "options": {
            "useCssVariable": true,
            "cssVariableTemplate": {
              "tokenNameTemplate": "--{{groups}}-{{token}}"
            }
          }
        }
      ]
    }
  ]
}/** @type {import('tailwindcss').Config} */
module.exports = {
  theme: {
    extend: {
      colors: {
        colors: {
          core: {
            label: {
              'blue-base': {
                dark: 'var(--core-label-blue-base)',
                light: 'var(--core-label-blue-base)'
              },
              'blue-lighter': {
                dark: 'var(--core-label-blue-lighter)',
                light: 'var(--core-label-blue-lighter)'
              }
            }
          },
          aliases: {
            border: {
              active: {
                dark: 'var(--aliases-border-active)',
                light: 'var(--aliases-border-active)'
              }
            }
          }
        }
      },
      spacing: {
        'dimensions-base-dimension-01-desktop': 'var(--base-dimension-01)',
        'dimensions-base-dimension-01-mobile': 'var(--base-dimension-01)',
        'dimensions-base-dimension-02-desktop': 'var(--base-dimension-02)',
        'dimensions-base-dimension-02-mobile': 'var(--base-dimension-02)'
      }
    }
  }
}Learn more about how to configure Specify to generate design tokens and assets fitting your company standards.
By default, without any parsers, Specify returns your design data as raw data:
Design tokens are returned in JSON
Assets are returned as files
A configuration file helps you:
request design tokens and assets from a Specify repository
transform them to fit your company standards thanks to rules, token types and parsers.
A configuration is composed of 3 main properties:
repository
personalAccessToken
rules
The name of the Specify repository you want to pull your design tokens and assets from.
Let's say we have the following repository in Specify called "all-design-data" located in the "@acme-inc" organization.
We target it like this:
module.exports = {
  repository: '@acme-inc/all-design-data',
  personalAccessToken: '<your-personal-access-token>',
  rules: [],
};{
  "repository": "@acme-inc/all-design-data",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": []
}The Specify personalAccessToken used to authenticate your actions.
module.exports = {
  repository: '@workspace/repository',
  personalAccessToken: '<your-personal-access-token>',
  rules: [],
};{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": []
}Rules help you transform your design tokens and assets the way you want.
You can have as many rules as you want and you can have rules that transform several Token types at once.
A rule is composed of the following properties:
interface Rule {
  name: string;
  path: string;
  filter?: {
    types: Array<TokenType>
  };
  parsers?: Array<Parser>;
};name
string
true
The name of your rule.
path
string
true
The path in your project where you want Specify to generate your design data.
If you want to pull , or token types you must set a directory ().
filter
false
The list of you want your rule to target.
parsers
Array<Parser>
false
The parsers you want to apply to transform your . For further details see .
Parsers are functions allowing you to transform design tokens and assets coming from Specify to fit your needs and company standards.
Inside a configuration, a parser has the following properties:
interface Parser {
  name: string;
  options?: Record<string, any>;
}name
string
true
The name of the parser. Choose from .
options
false
The options relative to the parser you apply. Each parser has its own options you can find in their respective README file.
Here's a rule named "Design Tokens" that:
targets color and measurement design tokens
sorts them alphabetically by their name
transforms them as CSS Custom Properties
writes them in a design-tokens.css file inside a styles folder
[
  {
    name: 'Design Tokens',
    path: 'styles/design-tokens.css',
    filter: {
      types: ['color', 'measurement']
    },
    parsers: [
      {
        name: 'sort-by',
        options: {
          keys: ['name']
        }
      },
      {
        name: 'to-css-custom-properties'
      }
    ]
  },
][
  {
    "name": "Design Tokens",
    "path": "styles/design-tokens.css",
    "filter": {
      "types": ["color", "measurement"]
    },
    "parsers": [
      {
        "name": "sort-by",
        "options": {
          "keys": ["name"]
        }
      },
      {
        "name": "to-css-custom-properties"
      }
    ]
  }
]The following examples are made to be used with the Specify CLI.
Requirements:
a Specify repository containing design tokens
a valid personal access token (Generate one ↗)
Run all examples by copying the code and running the specify pull command.
Here's a basic configuration file that targets a Specify repository called all-design-data from the @acme-inc organization:
{
  "repository": "@acme-inc/all-design-data",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "All design tokens in JSON",
      "path": "design-tokens.json",
      "parsers": []
    }
  ]
}module.exports = {
  repository: '@acme-inc/all-design-data',
  personalAccessToken: '<your-personal-access-token>',
  rules: [
    {
      name: 'All design tokens in JSON',
      path: 'design-tokens.json',
      parsers: [],
    },    
  ],
};This example config file will return a design-tokens.json file containing all design tokens and assets stored in the all-design-data repository.
Here's an example of a token value returned by Specify:
{
  "id": String,
  "createdAt": String,
  "updatedAt": String,
  "name": String,
  "value": Object,
  "meta": Object,
  "type": String,
  "originId": String,
  "sourceId": String,
  "description": String,
  "repositoryId": String
}Now let's update our previous configuration to only pull colors and transform them as CSS Custom Properties in HSL.
module.exports = {
  repository: '@acme-inc/all-design-data',
  personalAccessToken: '<your-personal-access-token>',
  rules: [
    {
      name: 'All design tokens in JSON',
      path: 'colors.css',
      filter: {
        types: ['color']
      },
      parsers: [
        {
          name: 'to-css-custom-properties',
          options: {
            formatTokens: {
              color: 'hsl'
            },
          },
        },
      ],
    },
  ],
};{
  "repository": "@acme-inc/all-design-data",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Colors as CSS Custom Properties",
      "path": "colors.css",
      "filter": {
        "types": ["color"]
      },
      "parsers": [
        {
          "name": "to-css-custom-properties",
          "options": {
            "formatTokens": {
              "color": "hsl"
            }
          }
        }
      ]
    }
  ]
}Here is the input returned by Specify and the output generated by Specify after executing our configuration.
[
  {
    "name": "Primary/100",
    "value": {
      "a": 1,
      "b": 254,
      "g": 233,
      "r": 237
    },
    "type": "color",
    "description": ""
  },
  {
    "name": "Primary/200",
    "value": {
      "a": 1,
      "b": 254,
      "g": 214,
      "r": 221
    },
    "type": "color",
    "description": ""
  },
  {
    "name": "Primary/300",
    "value": {
      "a": 1,
      "b": 253,
      "g": 181,
      "r": 196
    },
    "type": "color",
    "description": ""
  }
]:root {
  /* COLOR */
  --primary-100: hsl(251, 91%, 95%);
  --primary-200: hsl(251, 95%, 92%);
  --primary-300: hsl(252, 95%, 85%);
}Parsers are functions allowing you to transform design tokens and assets coming from Specify to fit your needs and company standards.
By default, without any parsers, Specify will return your design data as raw data:
Design tokens are returned in JSON
Assets are returned as files
There are high chances you need to transform those design data to fit your needs. Parsers help you do just that.
Parsers are functions allowing you to transform design tokens and assets coming from Specify to fit your needs and company standards.
A parser does the following job:
Receives design data as input
Transforms this design data
Returns the transformed data
The data returned by a parser can either be:
Design data that can be used by another parser coming next in your transformation pipeline
A file so it can be used by people, frameworks, or scripts
Parsers are ordered and takes specific input to generate specific output. This way, we can easily test the input coming from the previous parser to check if the whole parsers process will work.
Parsers are classified in 2 categories: technology and utility.
Technology parsers help you transform your design tokens to specific technologies and formats (CSS Custom properties, SCSS, Tailwind, a Javascript theme object compatible with React Native...)
Some examples:
Utility parsers take care of "smaller" transformation. Like converting a pixel value to rem or transforming a string to kebabcase.
Some examples:
All parsers are open source and available on the following GitHub repository.
Apply camelcase function on specific keys from a design token.
Convert font in several formats.
Filter tokens and assets by their name using a regular expression.
Replace all the stroke and fill attribute raw color value by its corresponding design token as a CSS variable. If no design token match, the raw value will be left as is.
Apply kebabcase function on specific keys from a design token.
Have design tokens referencing other ones.
Set a structured filename on your assets. It won't rename your asset but only add a new filename property on the asset object. The filename structure uses  as a template engine.
Omit keys from a design token not given in parameters.
Apply pascalcase function on specific keys from a design token.
Get only specific keys from a design token given in params.
Concatenate two strings.
Convert the value of a measurement design token from pixel to rem.
Replace any string matched by a regex by a new string.
Round any measurement design token with specific precision.
Apply snakecase function on specific keys from a design token.
Loop on several design tokens and sort them according to their respective key values.
Concatenate two strings.
Wrap SVG files within a JSX component.
Optimize vectors using .
Transform design tokens in CSS Custom Properties.
Create CSS @font-face rules to import your font files.
Create text styles as CSS classes.
Create a .
Format design tokens to create a theme compatible with the .
Transform design tokens in JSS.
Transform design tokens to a JavaScript theme object compatible with .
Generate .scss files containing Scss map and function / mixin to access the values of the tokens.
Create text styles formatted as .
Transform design tokens in SCSS variables.
Generate configuration files for all your design tokens coming from Specify.
Format design tokens to create a theme compatible with the .
Format design tokens to create a theme compatible with the .
Format design tokens to create their corresponding TypeScript types.


Record<'types', Array<TokenType>>Record<string, any>
Types define every type of design token and asset Specify is compatible with. Use them to target specific types of design data you want to pull from Specify and manage with rules and parsers.
Types define every type of design token and asset Specify is compatible with. Use them to target specific types of design tokens and assets you want to pull from Specify.
In Specify, types are displayed as "categories" of design data you can create and find in your Specify repository.
Specify is compatible with the following design tokens and assets under the TokenType type.
A border is a line surrounding a UI element. According to your target platform capabilities, you can define the border to go inside (inner border), outside (outer border), or between them (center).
Borders are considered as composite design tokens ↗ because they are composed of several design tokens.
interface BorderValue {
  color: {
    value: ColorValue;
  };
  type:
    | 'none'
    | 'hidden'
    | 'dotted'
    | 'dashed'
    | 'solid'
    | 'double'
    | 'groove'
    | 'ridge'
    | 'inset'
    | 'outset';
  width: {
    value: MeasurementValue;
  };
  align?: string;
  radii?: MeasurementValue;
  rectangleCornerRadii?: Array<MeasurementValue>;
  dashes?: Array<MeasurementValue>;
}Colors have meaning and support the purpose of the content, communicating things like hierarchy of information, interactive states, and the difference between distinct elements in your UI. Among all your design token types, color is surely one of the most important ones.
interface ColorValue {
  r: number;
  g: number;
  b: number;
  a: number;
}The Depth token type sets a UI element's position on the z-axis. More commonly called z-index on Web ↗ and zIndex on Android ↗ and iOS ↗.
interface DepthValue {
  depth: number;
}Represents the length of time in milliseconds an animation or animation cycle takes to complete, such as 200 milliseconds (cf DTCG ↗).
interface DurationValue {
  duration: number;
  unit: string;
}A gradient is the gradual blending from one color to another. It enables the designer to almost create a new color. It makes objects stand out by adding a new dimension to the design and adding realism to the object. In simple terms, gradients add depth.
Gradients are considered as composite design tokens ↗ because they are composed of several design tokens.
interface StepForGradient {
  type: string;
  color: {
    value: ColorValue;
  };
  position: number;
}
interface Gradient {
  angle: string;
  colors: Array<StepForGradient>;
}
interface GradientValue {
  gradients: Array<Gradient>;
}Measurement or Dimension ↗ design tokens help you define size values.
Common design tokens can be defined from this type:
internal margins
external margins
a spacing scale
a border width
a breakpoint
a font size
border radii...
interface MeasurementValue {
  measure: number;
  unit?: string;
}Opacity design tokens help you set the opacity of UI elements.
interface OpacityValue {
  opacity: number;
}Shadows help you communicate components elevation in your UIs. Popular variations and names include box-shadow, drop shadow, and many more.
Shadows are considered as composite design tokens ↗ because they are composed of several design tokens.
type ShadowValue = Array<{
  color: {
    value: ColorValue;
  };
  offsetX: {
    value: MeasurementValue;
  };
  offsetY: {
    value: MeasurementValue;
  };
  blur: {
    value: MeasurementValue;
  };
  spread?: {
    value: MeasurementValue;
  };
  isInner: boolean;
}>;Text styles or typography helps your UI be usable. They create balance, hierarchy and structure for your content. Some say that "Web is 95% typography". To push this even further let's say UI are 95% typography. In other words, pay a great deal of attention to typography.
A text style is composed of several child design decisions that could be considered as single design tokens like:
a line-height
a font size
a letter spacing
a font name
Text styles are considered as composite design tokens ↗ because they are composed of several design tokens.
export type TextTransformValue =
  | 'none'
  | 'capitalize'
  | 'uppercase'
  | 'lowercase';
export type TextDecorationValue =
  | 'none'
  | 'underline'
  | 'overline'
  | 'line-through'
  | 'dashed'
  | 'wavy';
export type HorizontalAlignValue =
  | 'initial'
  | 'left'
  | 'right'
  | 'center'
  | 'justify'
  | 'start'
  | 'end'
  | 'justify-all'
  | 'match-parent';
export type VerticalAlignValue =
  | 'initial'
  | 'baseline'
  | 'sub'
  | 'super'
  | 'text-top'
  | 'text-bottom'
  | 'middle'
  | 'top'
  | 'bottom';
  
export interface TextStyleValue {
  color?: {
    value: ColorValue;
  };
  font: {
    value: FontValue;
  };
  fontSize: {
    value: MeasurementValue;
  };
  lineHeight?: {
    value: MeasurementValue;
  };
  letterSpacing?: {
    value: MeasurementValue;
  };
  textAlign?: {
    horizontal?: HorizontalAlignValue;
    vertical?: VerticalAlignValue;
  };
  textTransform?: TextTransformValue;
  fontVariant?: Array<string>;
  textDecoration?: Array<TextDecorationValue>;
  textIndent?: {
    value: MeasurementValue;
  };
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / Borders",
      "path": "borders.json",
      "filter": {
        "types": [
          "border"
        ]
      }
    }
  ]
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / Colors",
      "path": "colors.json",
      "filter": {
        "types": [
          "color"
        ]
      }
    }
  ]
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / zIndex",
      "path": "zIndex.json",
      "filter": {
        "types": [
          "depth"
        ]
      }
    }
  ]
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / durations",
      "path": "durations.json",
      "filter": {
        "types": [
          "duration"
        ]
      }
    }
  ]
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / Gradients",
      "path": "gradients.json",
      "filter": {
        "types": [
          "gradient"
        ]
      }
    }
  ]
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / Measurements",
      "path": "measurements.json",
      "filter": {
        "types": [
          "measurement"
        ]
      }
    }
  ]
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / Opacities",
      "path": "opacities.json",
      "filter": {
        "types": [
          "opacity"
        ]
      }
    }
  ]
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / Shadows",
      "path": "shadows.json",
      "filter": {
        "types": [
          "shadow"
        ]
      }
    }
  ]
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / Text Styles",
      "path": "textStyles.json",
      "filter": {
        "types": [
          "textStyle"
        ]
      }
    }
  ]
}Bitmaps are raster images you can use in many contexts. They are basically any image you can display in a UI that is a .png, .jpeg, .webp, .avif...
interface BitmapValue {
  url: string;
  dimension?: number;
  format?: string;
}Fonts are files containing typefaces used by your text styles.
In Specify, all font files are stored as .ttf files by default. You can pull and convert them on the fly thanks to the convert-font ↗ parser.
export type Provider = 'Custom font' | 'Google Fonts';
export type FontWeightKeys = '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
export interface FontValue {
  fontFamily: string;
  fontPostScriptName: string;
  fontWeight?: string | number;
  fontFileMissing?: boolean;
  isItalic?: boolean;
  provider?: Provider;
  url?: string;
  format?: 'ttf';
}By "vectors" we mean vector images (e.g., SVG and PDF files). You can use them for 2 main purposes: iconography and illustration. In the following section we will only focus on icons.
Icons act a visual aids to help users complete tasks. We advise you to have an harmonic set of icons you can use to draw attention to specific actions.
interface VectorValue {
  url: string;
  format: 'svg' | 'pdf';
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / Images",
      "path": "bitmaps.json",
      "filter": {
        "types": [
          "bitmap"
        ]
      }
    }
  ]
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / Fonts",
      "path": "fonts.json",
      "filter": {
        "types": [
          "font"
        ]
      }
    }
  ]
}{
  "repository": "@workspace/repository",
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Design Tokens / Icons",
      "path": "vectors.json",
      "filter": {
        "types": [
          "vector"
        ]
      }
    }
  ]
}