Skip to content

Instantly share code, notes, and snippets.

@danhollick
Created February 4, 2020 13:01
Show Gist options
  • Save danhollick/d46a9774826e8c990c6239e0b81f6313 to your computer and use it in GitHub Desktop.
Save danhollick/d46a9774826e8c990c6239e0b81f6313 to your computer and use it in GitHub Desktop.
Find nodes with fills
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