Skip to content

Script to fetch styles from Figma file and generate Swift color palette

Notifications You must be signed in to change notification settings

bllizard22/PaletteGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PaletteGenerator

This tool helps:

  • Use Figma API to fetch colors data

    Styles library should be published to enable API usage

  • Rearrange it in case you have light/dark mode values

  • Generate swift file from fetched data

  • Print out added, deleted, and renamed tokens using key parameter to compare

    image

Quick Start

  • Start with adding all required values
  • Compile script with ./buildGenerator.sh
  • Execute ./PaletteGenerator

Figma API fetcher

Uses public Figma API to collect data from the styles library and prepare reusable JSON. Details here

image

Swift CodeGen

This stage generates Swift file with color values enum using Stencil. It takes data from Figma API fetcher output JSON.

You can check templates for generator here

image