Skip to main content
Question

Figma plugin API to add/update local styles or variables


Abhinav1

Hi, I know we can get all the local styles using the plugin api Figma.getLocalPaintStyles(). But is there any API to update or add localStyles? Basically I want to get all the colors from the selected frames using Figma.getSelectionColors(). And then add the colors as variables or color styles. How do I add/update variables or colorstyles using any plugin API?

This topic has been closed for comments

6 replies

tank666
  • 4863 replies
  • April 25, 2024

Abhinav1
  • Author
  • New Member
  • 4 replies
  • April 25, 2024

Thanks. 2 more questions:

  1. Is there any similar plugin API to create local style as well?
  2. Can I replace a specific color fill with the corresponding variable/localStyle with the same color hexcode or rgb value using a plugin API?

Gleb
  • Power Member
  • 4706 replies
  • April 25, 2024

First link


Abhinav1
  • Author
  • New Member
  • 4 replies
  • April 25, 2024

Okay. I think I found it. createPaintStyle(). Thanks


Gleb
  • Power Member
  • 4706 replies
  • April 25, 2024

Yes, the link goes to createPaintStyle method.

Yes, absolutely. Just set the fillStyleId or stroke whatever other field you need.


Abhinav1
  • Author
  • New Member
  • 4 replies
  • April 25, 2024

Thank you 🙂


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings