Skip to main content
Question

Grabbing colors from figma libraries (colors from both Styles & Variables) via plugin API possible?

  • January 25, 2025
  • 1 reply
  • 144 views

jkvx

I’m doing some plugin development and have a figma document that has a couple libraries added to the file, and these libraries contain both variables and styles with different color values. I am trying to access the color values for all these variables and styles from both libraries programmatically via the plugin API.

 

Ex:

 

 

Is this even possible currently? Or is there any workaround to access the color values associated with variables & styles from libraries associated with your document?

 

I know the plugin has a teamLibrary API designed to work with library files, but I only see two available methods (getAvailableLibraryVariableCollectionsAsync and getVariablesInLibraryCollectionAsync), and I don’t think either of these are able to give me the color values associated with the variables in the library. And in addition, neither of these methods work with Styles in the libraries (only variables).

 

Any input is appreciated, thanks!

1 reply

Ashutosh Verma

yes you can import local variables and styles , you can use following APIs

getLocalVariables() → to import local variable

getLocalTextStyles() → to import local effect styles

getLocalEffectStyles() → to import local text styles

getLocalGridStyles() → to import local grid styles

getLocalColorStyles() → to import local grid styles


Reply


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