Skip to content

caioborghi-swe/figma2css

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Design Token Converter

A utility for working with design tokens in CSS. This project converts an export.json file, generated by Variables Pro Figma plugin, into a design-tokens.css

Features

  • Complete design token system with semantic naming
  • Light and dark theme support via CSS classes
  • System preference detection with prefers-color-scheme
  • Organized token categories:
    • Typography (font family, weight, size, line height)
    • Colors (brand, semantic, and functional palettes)
    • Spacing and layout tokens
    • Interactive element styling

How to run

Using node:

node convert.js export.json tokens.css

Using Bun:

bun convert.js export.json tokens.css

Where the first param is the input json file and the second param is the output css file.

Usage

Basic Integration

Import the CSS file in your project:

// In your main entry file
import 'design-token-converter/design-tokens.css';

Applying Themes

Apply themes by adding a class to your root HTML element:

<!-- Light theme (default) -->
<html class="light-theme">
  <!-- Your content -->
</html>

<!-- Dark theme -->
<html class="dark-theme">
  <!-- Your content -->
</html>

System Preference Detection

The CSS automatically detects system preferences if no theme class is specified:

<html>
  <!-- Will follow system preference -->
</html>

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors