This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const frames = Array.from(figma.currentPage.findAll(item => item.type === 'FRAME' && item.parent.type === 'PAGE')); | |
figma.currentPage.selection = frames; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var groupsWithOneChild = Array.from(figma.root.findAll(x => x.type === 'GROUP' && x.children.length === 1)); | |
if (groupsWithOneChild) { | |
groupsWithOneChild.forEach(group => { | |
let parent = group.parent; | |
let index = parent.children.indexOf(group); | |
let child = group.children[0]; | |
parent.insertChild(index, child); | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const colorStyles = figma.getLocalPaintStyles(); | |
var hexValueAndName = []; // array of hex values and their names | |
var hexValues = []; //array with hex values only | |
function makeHex(r,g,b) { | |
let red = rgbToHex(r); | |
let green = rgbToHex(g); | |
let blue = rgbToHex(b); | |
return red+green+blue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
figma.currentPage.findAll(i => i.type === 'INSTANCES' && i.masterComponent.remote === true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPage(node) { | |
let item = node; | |
while (item.type != 'PAGE') { | |
item = item.parent; | |
console.log(item); | |
} | |
return item; | |
} |