Learn R Programming

Rigma

The goal of Rigma is to provide a user friendly client to ‘Figma’ API. It uses the latest httr2 for a stable interface with the ‘Figma’ API. More than 20 methods are provided to interact with ‘Figma’ files, and teams. Get design data into R by reading published components and styles, converting and downloading images, getting access to the full ‘Figma’ file as a hierarchical data structure, and much more. Enhance your creativity and streamline the application development by automating the extraction, transformation, and loading of design data to your applications and documents.

Installation

You can install the development version of ‘Rigma’ from GitHub with:

# install.packages("devtools")
devtools::install_github("AleKoure/Rigma")

Getting started

An account can be accessed using an API by the owner of a personal access token just as if they were the user who created the token.

Make your own access token.

  • Open your Figma account and log in.
  • From the top-left menu in Figma, select Account Settings.
  • Locate the section on personal access tokens.
  • Select New Token by clicking.
  • There will be a token created. This will be your last opportunity to copy the token, so be careful to store a copy of it safely.

When you retrieve the personal access token save it as an environmental variable (e.g. edit .Renviron by typing usethis::edir_r_environ()).

FIGMA_ACCESS_TOKEN="YOUR_ACCESS_TOKEN_GOES_HERE!!!"

After saving your changes restart R session.

Example

Open ‘Figma’ and navigate to your favorite file. In the URL you can see the key of the file. To retrieve the File as an R object execute:

example_file_key <- "sFHgQh9dL6369o5wrZHmdR"
get_file(example_file_key)

A tree of nodes is used to represent the ‘Figma’ file. Every file has a DOCUMENT node at the root, and any CANVAS nodes branch out of that node.

Copy Link

Version

Install

install.packages('Rigma')

Monthly Downloads

208

Version

0.3.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Alexandros Kouretsis

Last Published

February 23rd, 2025

Functions in Rigma (0.3.0)

get_component_sets

GET component set
Rigma-package

Rigma: Access to the 'Figma' API
get_file_components

GET file components
add_color

Add color to design table data
delete_comment_reactions

DELETE comment reactions
get_image

GET image
get_image_fills

GET image fills
req_rigma_agent

Add metadata to Rigma request
get_file_nodes

GET file nodes
extract_bslib_palette

Extract bslib palette
request_figma

Create a request for the Figma API with an optional method
possibly_thumbnail_color

Possibly extract thumbnail color
post_comment_reactions

POST comment reactions
get_team_styles

GET team styles
get_file_component_sets

GET file component sets
get_comments

GET comments
get_file

GET file
get_comments_reactions

GET comments reactions
get_project_files

GET project files
req_figma_template

Set the API URL template based on the specified endpoint
get_team_component_sets

GET team component sets
get_file_styles

GET file styles
post_comment

POST comment
get_team_components

GET team components
thumbnail_color

Find thumbnail color
safe_download

Safe download files
%>%

Pipe operator
text_data_from_styles

Get text data from styles
get_team_projects

GET team projects
get_file_versions

GET file versions
as_design_tibble

Transform data to tabular format
delete_comment

DELETE comments
get_component

GET component