Skip to main content
Solved

Editing color styles with a plugin: Figma API problem

  • November 3, 2021
  • 4 replies
  • 2288 views

Daniela_Muntyan

Hey! We are creating a plugin to help us edit styles in the design system and keep our tokens in order. The development team ran into an issue we found in the Figma documentation. Unfortunately, Figma’s documentation states that we cannot edit color styles with the plugin. But for example, we can easily edit font styles.
Tell me, can we give the right to edit via Figma API specifically for our organization? This is a critical feature for us to help develop and maintain design styles.
If so, tell me the approximate terms of implementation of such access, and is it possible?

Thanks a lot!


Best answer by tank666

In read-only, properties can be overwritten. For example:

figma.getStyleById('S:styleId,').paints = [
	{
		type: "SOLID",
		visible: true,
		opacity: 1,
		blendMode: "NORMAL",
		color: {
			r: 0.4, g: 0, b: 0
		}
	}
]

You can learn more at Figma Developers:

figma.com
View original
This topic has been closed for comments

4 replies

tank666
  • 4871 replies
  • Answer
  • November 3, 2021

In read-only, properties can be overwritten. For example:

figma.getStyleById('S:styleId,').paints = [
	{
		type: "SOLID",
		visible: true,
		opacity: 1,
		blendMode: "NORMAL",
		color: {
			r: 0.4, g: 0, b: 0
		}
	}
]

You can learn more at Figma Developers:

figma.com

Daniela_Muntyan

Is it possible to edit the style colors and not in the layout?

I need to edit style colors with the plugin.

If I understood the documentation correctly, it only allows editing hex values, but not the style in Figma. I need to be able to edit just the styles but not the elements in the design


tank666
  • 4871 replies
  • November 3, 2021

@Daniela_Muntyan, the example code above changes the style properties, not the layout.


Daniela_Muntyan1

Thank you! It works 🙌


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