Skip to content
Skip to content
Skip to content

Tool

Turns a design token file into typed CSS custom properties, with dark mode built in.

stars
410
downloads
6,300
license
MIT
Install
npm install -D tokens-to-css
A dark metal lattice grid on black stone

README.mdMIT

tokens-to-css reads the token file your design tool exports and writes three things from it: CSS custom properties, a typed TypeScript map and a variables file the design library can import back.

Usage

bash
npx tokens-to-css tokens.json --out src/tokens
css
:root {
  --color-ground: #0b0c0e;
  --color-accent: #c6ff3d;
  --space-4: 16px;
}
@media (prefers-color-scheme: light) {
  :root { --color-ground: #f6f6f1; }
}

Details

  • Aliases are resolved, and kept as var() references where that is useful
  • Dark and light modes come from token sets, not from duplicated files
  • The TypeScript map makes a typo in a token name a compile error

Tool

Turns a design token file into typed CSS custom properties, with dark mode built in.

stars
410
downloads
6,300
license
MIT
Install
npm install -D tokens-to-css
A dark metal lattice grid on black stone

README.mdMIT

tokens-to-css reads the token file your design tool exports and writes three things from it: CSS custom properties, a typed TypeScript map and a variables file the design library can import back.

Usage

bash
npx tokens-to-css tokens.json --out src/tokens
css
:root {
  --color-ground: #0b0c0e;
  --color-accent: #c6ff3d;
  --space-4: 16px;
}
@media (prefers-color-scheme: light) {
  :root { --color-ground: #f6f6f1; }
}

Details

  • Aliases are resolved, and kept as var() references where that is useful
  • Dark and light modes come from token sets, not from duplicated files
  • The TypeScript map makes a typo in a token name a compile error

Tool

Turns a design token file into typed CSS custom properties, with dark mode built in.

stars
410
downloads
6,300
license
MIT
Install
npm install -D tokens-to-css
A dark metal lattice grid on black stone

README.mdMIT

tokens-to-css reads the token file your design tool exports and writes three things from it: CSS custom properties, a typed TypeScript map and a variables file the design library can import back.

Usage

bash
npx tokens-to-css tokens.json --out src/tokens
css
:root {
  --color-ground: #0b0c0e;
  --color-accent: #c6ff3d;
  --space-4: 16px;
}
@media (prefers-color-scheme: light) {
  :root { --color-ground: #f6f6f1; }
}

Details

  • Aliases are resolved, and kept as var() references where that is useful
  • Dark and light modes come from token sets, not from duplicated files
  • The TypeScript map makes a typo in a token name a compile error

Start a project

Three quick picks so the first reply is useful. You finish the message on the contact page.

What do you need?

Rough budget

brief.tsdraft, not sent

Brief so far: nothing picked yet

or write to hello@sorenhale.dev

Nothing is sent from this page. Your picks are kept in this browser tab and wait for you on the contact form.

Start a project

Three quick picks so the first reply is useful. You finish the message on the contact page.

What do you need?

Rough budget

brief.tsdraft, not sent

Brief so far: nothing picked yet

or write to hello@sorenhale.dev

Nothing is sent from this page. Your picks are kept in this browser tab and wait for you on the contact form.

Start a project

Three quick picks so the first reply is useful. You finish the message on the contact page.

What do you need?

Rough budget

brief.tsdraft, not sent

Brief so far: nothing picked yet

or write to hello@sorenhale.dev

Nothing is sent from this page. Your picks are kept in this browser tab and wait for you on the contact form.

Footer

Local time, Oslo

Footer

Local time, Oslo

Footer

Local time, Oslo

Create a free website with Framer, the website builder loved by startups, designers and agencies.