Skip to main content
Question

Applying Color Variable to an Instance or Layer

  • January 13, 2024
  • 1 reply
  • 279 views

Bradley_Kounter

Theres a ton of API’s im finding on creating variables, adding modes, etc. But I have a complicated workflow of:

Importing a component (instance)
Grabbing a local variable from a collection
Targeting a layer and then applying that local variable to it

Ive been trying to for hours use the boundVariableColor whatever method to accomplish this and keep either getting:

copyColor.Type has to equal “SOLID” which it does, or “expected a node and got a string instead”. Am i missing something? Is this even possible?

This topic has been closed for replies.

1 reply

y_toku
Figmate
  • Community Support
  • 2545 replies
  • January 16, 2024

Hey there,

We have a code sample for how to apply color variables to a node here:
https://www.figma.com/plugin-docs/working-with-variables/#example-binding-a-variable-to-a-node-or-style.

Also, clone() is defined here:
https://www.figma.com/plugin-docs/editing-properties/#the-how

Could you please take a look at it? If that doesn’t help, please feel free to reply on this.

Thanks,
Toku


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