Last active
February 2, 2020 12:14
-
-
Save danhollick/5e9cf8c96a7fcda63e0faa30c2764676 to your computer and use it in GitHub Desktop.
Logging selection change
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
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