
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@equinor/eds-tokens
Advanced tools
Design tokens used in the EDS, including colors, spacing, typography, and more. These tokens are synchronized with Figma variables and provide a single source of truth for design decisions across the design system.
For LLM instructions on using colors, see the instructions/colors.md, or jump directly to the static or dynamic instructions.
pnpm add @equinor/eds-tokens
The package provides two token systems:
The new token system uses CSS custom properties that automatically adapt to light and dark color schemes using the modern light-dark() function. These tokens are directly synced from Figma variables.
Import the variables stylesheet:
@import '@equinor/eds-tokens/css/variables';
Then use the CSS custom properties in your styles:
.my-component {
background-color: var(--eds-color-bg-neutral-surface);
color: var(--eds-color-text-neutral-strong);
border: 1px solid var(--eds-color-border-neutral-subtle);
padding: var(--eds-spacing-inline-md);
border-radius: var(--eds-spacing-border-radius-rounded);
}
The variables automatically respond to color scheme changes:
/* Applies to elements with data-color-scheme attribute */
[data-color-scheme="dark"] {
/* Variables automatically use dark mode values */
}
/* Or use the native prefers-color-scheme */
@media (prefers-color-scheme: dark) {
/* Variables automatically use dark mode values */
}
For scenarios where you need colour variables in JavaScript:
Import the light and dark semantic color tokens:
// Import semantic color scheme tokens
import * as lightSemantic from '@equinor/eds-tokens/js/color/color-scheme/light-semantic'
import * as darkSemantic from '@equinor/eds-tokens/js/color/color-scheme/dark-semantic'
// Use semantic tokens with light/dark values
const lightSurface = lightSemantic.BG_NEUTRAL_SURFACE
const darkSurface = darkSemantic.BG_NEUTRAL_SURFACE
const lightAccent = lightSemantic.BG_ACCENT_FILL_EMPHASIS_DEFAULT
const darkAccent = darkSemantic.BG_ACCENT_FILL_EMPHASIS_DEFAULT
const lightBorder = lightSemantic.BORDER_INFO_MEDIUM
const darkBorder = darkSemantic.BORDER_INFO_MEDIUM
// Import spacing values for different density modes
import * as comfortableSpacing from '@equinor/eds-tokens/js/spacing/comfortable'
import * as spaciousSpacing from '@equinor/eds-tokens/js/spacing/spacious'
// Use the values (numbers in pixels)
const padding = comfortableSpacing.SPACING_INLINE_MD
const borderRadius = comfortableSpacing.SPACING_BORDER_RADIUS_ROUNDED
The variables are available in two formats:
Flat format (/flat/) -- Simple key-value pairs for easy access
Nested format (/nested/) -- Hierarchical structure matching the token naming
The semantic color tokens are available for light and dark color schemes.
light-semantic.json / dark-semantic.json -- Semantic color tokens for each color scheme
// Import flat format tokens
import lightSemanticFlat from '@equinor/eds-tokens/json/color/color-scheme/flat/light-semantic.json'
import darkSemanticFlat from '@equinor/eds-tokens/json/color/color-scheme/flat/dark-semantic.json'
// Access values directly
const lightSurface = lightSemanticFlat['bg-neutral-surface'] // "#ffffff"
const darkSurface = darkSemanticFlat['bg-neutral-surface'] // "#262626"
// Import nested format tokens
import lightSemanticNested from '@equinor/eds-tokens/json/color/color-scheme/nested/light-semantic.json'
import darkSemanticNested from '@equinor/eds-tokens/json/color/color-scheme/nested/dark-semantic.json'
// Access values via hierarchical structure
const lightSurface = lightSemanticNested.bg.neutral.surface // "#ffffff"
const darkSurface = darkSemanticNested.bg.neutral.surface // "#262626"
The spacing system supports different density modes:
comfortable -- Default density for most applicationsspacious -- Increased spacing for better readabilityThe original token format is still available for existing applications. These tokens use a structured JavaScript object format.
import { tokens } from '@equinor/eds-tokens'
// Access token values
const primaryColor = tokens.colors.interactive.primary__resting.rgba
const spacing = tokens.spacings.comfortable.medium
const typography = tokens.typography.heading.h1
ot, woff or woff2 font required)We recommend migrating to CSS Variables for new projects to benefit from automatic theme support and better performance.
This repository contains a couple of GitHub Actions workflows:
These workflows demonstrate bi-directional syncing between variables in Figma and design tokens in a codebase using Figma's Variables REST API. For more background and a graphical representation of what these workflows do, see our Syncing design systems using Variables REST API FigJam file.
To use these workflows, you should copy the code in this repository into your organization and modify it to suit the needs of your design processes.
To use the "Sync Figma variables to tokens" workflow, you must be a full member of an Enterprise org in Figma. To use the "Sync tokens to Figma" workflow, you must also have an editor seat.
Both workflows assume that you have a single Figma file with local variable collections, along with one or more tokens json files in the tokens/ directory that adhere* to the draft W3C spec for Design Tokens. For demonstration purposes, this directory contains the tokens exported from the Get started with variables Community file. Have a copy of this file ready if you want to try out the workflow with these existing tokens.
*See
src/token_types.tsfor more details on the format of the expected tokens json files, including the deviations from the draft design tokens spec we've had to make. We expect there to be one tokens file per variable collection and mode.
In addition, you must also have a personal access token for the Figma API to allow these workflows to authenticate with the API. For the "Sync Figma variables to tokens" workflow, the token must have at least the Read-only Variables scope selected. For the "Sync tokens to Figma" workflow, the token must have the Read and write Variables scope selected.
Before running either of these workflows, you'll need to create an encrypted secret in your repository named GH_ACTION_VARIABLES_SYNC_FIGMA_TOKEN containing your personal access token.
Both workflows are configured to run manually for demonstration purposes, and are designed to be as conservative as possible in their functionality (see details below).
To run the "Sync Figma variables to tokens" workflow:
https://www.figma.com/file/{file_key}/{title}.tokens/ directory. If there are no changes to be made, then a pull request will not be created.This workflow has some key behaviors to note:
To run the "Sync tokens to Figma" workflow:
https://www.figma.com/file/{file_key}/{title}. Note: if you are trying out this workflow for the first time, use a file that is separate from your design system to avoid any unintended changes.This workflow has some key behaviors to note:
You can run the GitHub actions locally by running pnpm install and creating a .env file.
Example:
PERSONAL_ACCESS_TOKEN="your_personal_access_token"
How to create your personal access token
and then running:
# Defaults to writing to the tokens directory
pnpm run update-tokens
# and / or
pnpm run update-figma
The semantic variable references the first segment (collection) in the variable. For example, the first segment is “appearance” for the action variables. Variables defined in appearance point to the next segment, which for action variables would be prominence. In the prominence collection, we define a variable for each of the appearance modes so that these are represented in the context of each prominence mode. The variables in the “prominence” collection point to variables in the state collection, and again, we represent all the prominence modes as new variables in the state collection. For action variables, the journey ends here, and the variables in the state collection point to the light/dark color scheme variables in the color scheme collection.
The color scheme collection variables support all the combinations of modes in the different collections and are used to generate tokens in code. All the combinations of modes in different collections must be provided here so that the code syntax matches tokens in the code.
To set up tokens in Figma, start with the base value defined in the Colour Scheme collection. Once these are defined, you have all the different combinations of a variable and are ready to set up the collections you want to provide. Using the action variables as an example, you would first create the base values and then start with the variable’s last segment(collection). This is the taxonomy of our action variables: color/action/[appearance]/[prominence]/[state]. The last segment in this example would be the “state” collection. The state collection references the base values you defined in the Colour Scheme collection. In the state collection, you should define a variable for each mode in the previous segment; in this example, that would be all the modes you want to define in the prominence collection. Example: primary, secondary, tertiary. When this is ready, you continue to the segment before the prominence collection; in this example, this would be the appearance collection. The appearance collection is, in this example, the first segment and, therefore, the last collection you need to create. In this collection, you create all the variables you need. In our token taxonomy, we create a variable for different properties (text, icon, border, surface). These variables should reference the variables you created in the previous collection; in this example, that would be the specific appearance variables you created in the prominence collection.
FAQs
Design tokens for the Equinor Design System
The npm package @equinor/eds-tokens receives a total of 11,243 weekly downloads. As such, @equinor/eds-tokens popularity was classified as popular.
We found that @equinor/eds-tokens demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.