Skip to content

Instantly share code, notes, and snippets.

@steveruizok
Created December 11, 2020 16:12
Show Gist options
  • Save steveruizok/7aa04e21fa289b49e37e82f41050e2a7 to your computer and use it in GitHub Desktop.
Save steveruizok/7aa04e21fa289b49e37e82f41050e2a7 to your computer and use it in GitHub Desktop.
result of figma api request
{
"document": {
"id": "0:0",
"name": "Document",
"type": "DOCUMENT",
"children": [
{
"id": "0:1",
"name": "Page 1",
"type": "CANVAS",
"children": [
{
"id": "2:2",
"name": "Frame 1",
"type": "FRAME",
"blendMode": "PASS_THROUGH",
"children": [],
"absoluteBoundingBox": {
"x": 217,
"y": -323,
"width": 442,
"height": 332
},
"constraints": { "vertical": "TOP", "horizontal": "LEFT" },
"clipsContent": true,
"background": [
{
"blendMode": "NORMAL",
"type": "SOLID",
"color": { "r": 1, "g": 0, "b": 0, "a": 1 }
}
],
"fills": [
{
"blendMode": "NORMAL",
"type": "SOLID",
"color": { "r": 1, "g": 0, "b": 0, "a": 1 }
}
],
"strokes": [],
"strokeWeight": 1,
"strokeAlign": "INSIDE",
"backgroundColor": { "r": 1, "g": 0, "b": 0, "a": 1 },
"styles": { "fills": "3:0" },
"effects": []
},
{
"id": "3:3",
"name": "Frame 2",
"type": "COMPONENT",
"blendMode": "PASS_THROUGH",
"children": [
{
"id": "3:2",
"name": "Frame 1",
"type": "FRAME",
"blendMode": "PASS_THROUGH",
"children": [],
"absoluteBoundingBox": {
"x": 805,
"y": -158,
"width": 442,
"height": 332
},
"constraints": { "vertical": "TOP", "horizontal": "LEFT" },
"clipsContent": true,
"background": [
{
"blendMode": "NORMAL",
"type": "SOLID",
"color": { "r": 1, "g": 0, "b": 0, "a": 1 }
}
],
"fills": [
{
"blendMode": "NORMAL",
"type": "SOLID",
"color": { "r": 1, "g": 0, "b": 0, "a": 1 }
}
],
"strokes": [],
"strokeWeight": 1,
"strokeAlign": "INSIDE",
"backgroundColor": { "r": 1, "g": 0, "b": 0, "a": 1 },
"styles": { "fills": "3:0" },
"effects": []
}
],
"absoluteBoundingBox": {
"x": 766,
"y": -300,
"width": 519,
"height": 704
},
"constraints": { "vertical": "TOP", "horizontal": "LEFT" },
"clipsContent": true,
"background": [
{
"blendMode": "NORMAL",
"type": "SOLID",
"color": { "r": 1, "g": 1, "b": 1, "a": 1 }
}
],
"fills": [
{
"blendMode": "NORMAL",
"type": "SOLID",
"color": { "r": 1, "g": 1, "b": 1, "a": 1 }
}
],
"strokes": [],
"strokeWeight": 1,
"strokeAlign": "INSIDE",
"backgroundColor": { "r": 1, "g": 1, "b": 1, "a": 1 },
"effects": []
}
],
"backgroundColor": {
"r": 0.8980392217636108,
"g": 0.8980392217636108,
"b": 0.8980392217636108,
"a": 1
},
"prototypeStartNodeID": null,
"prototypeDevice": { "type": "NONE", "rotation": "NONE" }
}
]
},
"components": {
"3:3": {
"key": "e0d1d4ccae28ea804cf890ab7b2fd6fb6deaac8f",
"name": "Frame 2",
"description": ""
}
},
"schemaVersion": 0,
"styles": {
"3:0": {
"key": "5f589d77bc334f45f64c1f13e9c7ac46500bc6f0",
"name": "really red",
"styleType": "FILL",
"description": ""
}
},
"name": "Untitled",
"lastModified": "2020-12-11T16:03:35Z",
"thumbnailUrl": "https://s3-alpha-sig.figma.com/thumbnails/blank.png?Expires=1608508800&Signature=Bse4LhBuuHLehaIuEU8p1jpDA6~DrIUZD2MUvzTgPYeURG4NKIFCcZb9TRZSQjZhHt9~SSaS5057B2DElYdcmanzg1h-SQzuzLBpBvrgbC~FOacf~O5i9pDNv0OP~QuI3W0MxCYjQKM54kXMpa9X2nARE6HjQX5hY5nSx7Hq6uSvRsIq4GCWWzu~ARAs2IryD0aESCwmSIyDGOAy3JREM~-lmX9svra3UZXfELr2lAIKccZ2dNTKdKCZqOqTWJnpeOVKjZFgW~XjEt0WV447rRIPNAarMFUZxSX2feQtocWNpTd~B7ULfVIC7mWc1TR9ehZXj7CJC-YRpb6x5S4fBw__&Key-Pair-Id=APKAINTVSUGEWH5XD5UA",
"version": "586067413",
"role": "owner"
}
@steveruizok
Copy link
Author

steveruizok commented Dec 11, 2020

Styles are defined here: https://gist.github.com/steveruizok/7aa04e21fa289b49e37e82f41050e2a7#file-results-json-L137-L144

Here's the node that uses the style: https://gist.github.com/steveruizok/7aa04e21fa289b49e37e82f41050e2a7#file-results-json-L53-L87

We know it uses the style because the style is listed here: https://gist.github.com/steveruizok/7aa04e21fa289b49e37e82f41050e2a7#file-results-json-L85

But we need to know that it's applying that style to its background property. Its background property does not mention the style, only the hardcoded value of the style. https://gist.github.com/steveruizok/7aa04e21fa289b49e37e82f41050e2a7#file-results-json-L67-L73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment