Coder Social home page Coder Social logo

mulxcode / figma-theme-ui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lekoarts/figma-theme-ui

1.0 1.0 0.0 858 KB

Convert a Theme UI config to Figma Styles

License: MIT License

HTML 0.32% JavaScript 18.54% TypeScript 67.99% Svelte 13.15%

figma-theme-ui's Introduction

Theme UI Plugin for Figma

Convert a Theme UI config to Figma Styles.

Install the plugin

Usage

Choose a .js file that only contains an export and your theme. Example:

module.exports = {
  fonts: {
    body:
      '-apple-system, BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"',
    heading: "inherit",
  },
  fontSizes: [12, 14, 16, 20, 24, 32],
  fontWeights: {
    body: 400,
    heading: 700,
  },
  lineHeights: {
    body: 1.5,
    heading: 1.125,
  },
  colors: {
    text: "#000",
    background: "#fff",
    brand: {
      primary: "#07c",
      secondary: "#30c",
    },
    teal: [null, "#e6fffa", "#b2f5ea", "#81e6d9"],
  },
};

The shape of the theme has to follow the theme specification. Otherwise the plugin can't find your styles. More specifically, you'll need to bring the theme into the following shape (as shown above):

  • One module.exports export, nothing more in the file
  • fonts, fontWeights and lineHeights have to have the same keys (above: body and heading)
  • fontSizes has to be defined as Array<number>
  • fontWeights and lineHeights need to have a number as property

Lastly, click "Add Styles" to create your Figma Styles.

Development

Install the dependencies:

yarn install

And build the plugin:

yarn build

Go to your "Plugins" tab inside Figma and press the "+" button on "Development". Choose the manifest.json file inside public folder.

You now can open the plugin in any project. Run yarn dev to have rollup watch your changes. You'll need to re-open the plugin after every change.

Acknowledgements

  • Thanks to Figsvelte for his cool boilerplate to start a Figma plugin with Svelte
  • Thanks to tailwindcss-figma-plugin for giving me an idea on how to use Figma's API

figma-theme-ui's People

Contributors

renovate[bot] avatar lekoarts avatar plhnk avatar

Stargazers

MULX avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.