Skip to main content
100%

Update Figma Color Descriptions to include RGB

✓ Published0🌍 Public
KKevinGutowski
Last edited Sep 13, 2021
Created on Sep 13, 2021

This example demonstrates a workflow for automatically updating Figma color style descriptions to include their corresponding RGB values. It uses the Figma API’s `getLocalPaintStyles()` method to iterate over all paint styles in the document. For each style, the script extracts the `paints[0].color` properties and constructs a description string containing the red, green, and blue channels, scaled from 0–1 to 0–255 using the `(color.r*256).toFixed(0)` calculation. The resulting RGB code is then assigned directly to the paint style’s `description` field, providing a quick way to document color values in a design file.

AI-generated description

Similar vizzes