Giter VIP home page Giter VIP logo

tokengenerator's Introduction

TokenGenerator

A small program that turns design tokens into code. This is no Dana templating system, only code.

Motivation

Design systems are great. Your goals might include increased consistency for users, efficient collaboration between disciplines, and saving your team time. Generating code from a shared resource helps with all of those: it cuts down on inconsistencies in manually copying, is faster than manually copying, and lets everybody collaborate on one resource.

Why not a shrink-wrapped “build system” like this one from Amazon? Or why not talk directly to the Figma API? Sometimes you don’t need a code- and process-heavy suite of generalized tools just to generate a little code, especially when you’re still in the scrappy stage!

Installation

Download the latest program from Releases.

Usage

The TokenGenerator program has one required and two optional parameters:

  • target — Required. Use target to specify the output platform: Android, iOS, or web.
  • --semantic <semantic> — Optional. Location of the semantic colors. A URL or a local file is fine.
  • --swatch <swatch> — Optional. Location of the swatch colors. A URL or a local file is fine.
$./TokenGenerator <target> [--semantic <semantic>] [--swatch <swatch>]

The program writes to stdout, so to write a file use the write pipe >. It goes source > file. For example,

$ ./TokenGenerator ios --semantic 'URL_HERE' > Semantic.swift
$ ./TokenGenerator android --swatch ~/Downloads/colors.csv > Swatch.xml
$ ./TokenGenerator web --semantic 'URL_HERE' --swatch 'URL_HERE' > _colors.scss

Also try out $./TokenGenerator --help

Spreadsheet Format

Semantic

COLUMNS — The origin spreadsheet must have exactly five columns with these exact names:

  • Name
  • Light HighContrast
  • Light Normal
  • Dark
  • More Description

ROWS — The rows must be contiguous. You won’t like the output if they’re not. :)

CELLS — All color cells are required. A name’s “More Description” is optional.

Swatch

COLUMNS — The origin spreadsheet must have exactly two columns with these exact names:

  • Name
  • Hex Color

ROWS — The rows must be contiguous.

CELLS — All color cells are required.

Questions, bugs & contributing

If you’ve got a question, found a bug, or are wondering about contributing, please open an Issue. For contributing, please also read CONTRIBUTING.md.

tokengenerator's People

Contributors

loganmoseley avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  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.