Skip to main content
Abhinav1
New Member
April 25, 2024
Question

Figma plugin API to add/update local styles or variables

  • April 25, 2024
  • 6 replies
  • 967 views

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

6 replies

tank666
April 25, 2024
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Abhinav1
Abhinav1Author
New Member
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
April 25, 2024

First link

Abhinav1
Abhinav1Author
New Member
April 25, 2024

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

Gleb
Power Member
April 25, 2024

Yes, the link goes to createPaintStyle method.

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

Abhinav1
Abhinav1Author
New Member
April 25, 2024

Thank you 🙂