Skip to main content

Hi,


I’m using the API to get json data from a design file. In the Figma design file I’m using “Color Styles” to set File Wide colours to use throughout the design.



From the API I’m able to see these styles but the actual colour is not coming back. Is there a way to get this data?


Thanks in advance,


James


// snip
"styles": {
"202:8": {
"key": "780f8bf8bc19f762347725f5afad064a25763805",
"name": "tertiary",
"styleType": "FILL",
"description": ""
},
"202:10": {
"key": "8f24fda93275ce4bbcbb6a425a147628e475ca00",
"name": "tertiary_inverted",
"styleType": "FILL",
"description": ""
},
"202:5": {
"key": "0322a2ef7df337b1cd41403ea6ff43154d503426",
"name": "secondary",
"styleType": "FILL",
"description": ""
},
"206:14": {
"key": "db74dcd981ac6b6781e0b15d58646b2e72c9c3ab",
"name": "secondary_inverted",
"styleType": "FILL",
"description": ""
},
"102:3": {
"key": "28f1d840a237475d864cb57301ac40c5cd358bf6",
"name": "primary",
"styleType": "FILL",
"description": ""
},
"206:13": {
"key": "f3bab60173632c7a4b1b7323fd2115fcbcbad410",
"name": "primary_inverted",
"styleType": "FILL",
"description": ""
}
},
// snip

Following up…


I’ve been trying to read/search about this.


Is the only way to do this to really follow this method (Design tokens with Figma. A couple of days ago made a free UI Kit… | by Pavel Laptev | Prototypr) of creating palet objects in the file? This sounds like madness… isn’t the entire idea about having the styles in the json object so that you can use them?


I don’t see any API call to get the colour from the style key either?


Thanks again!


Once you’ve got the style IDs, you can get the node’s properties and values with the file nodes endpoint.

For example:


https://api.figma.com/v1/files/:key/nodes?ids=202:8

https://www.figma.com/developers/api#get-file-nodes-endpoint


Thanks @tank666 we’ll give this a shot!


Reply