Skip to content

Instantly share code, notes, and snippets.

@danhollick
Last active February 2, 2020 12:14
Show Gist options
  • Save danhollick/5e9cf8c96a7fcda63e0faa30c2764676 to your computer and use it in GitHub Desktop.
Save danhollick/5e9cf8c96a7fcda63e0faa30c2764676 to your computer and use it in GitHub Desktop.
Logging selection change
figma.showUI(__html__)
figma.on('selectionchange', () => {
if (figma.currentPage.selection.length > 1) {
// find nodes with fills that are of type SOLID
const selection = figma.currentPage.selection.filter(
node => node.fills.length > 0 && node.fills[0].type === 'SOLID'
)
console.log(selection[0].fills)
} else {
console.log('Select at least 2 layers')
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment