Created
February 4, 2020 13:01
-
-
Save danhollick/d46a9774826e8c990c6239e0b81f6313 to your computer and use it in GitHub Desktop.
Find nodes with fills
This file contains hidden or 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 findFills(nodes) { | |
const nodesWithFills = nodes.filter( | |
node => | |
node.fills && node.fills.length > 0 && node.fills[0].type === 'SOLID' | |
) | |
if (nodesWithFills.length <= 0) { | |
return figma.notify('Please select a layer that has a solid fill', { | |
timeout: 1000, | |
}) | |
} | |
const fills = nodesWithFills.map(node => node.fills[0]) | |
return fills | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment