Created
February 2, 2020 13:13
-
-
Save danhollick/5b3fcf1aba11b7db7a643bf8aa6a67e0 to your computer and use it in GitHub Desktop.
Send selection info to iFrame
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.on('selectionchange', () => { | |
| if (figma.currentPage.selection.length > 1) { | |
| const selection = figma.currentPage.selection.filter( | |
| node => node.fills.length > 0 && node.fills[0].type === 'SOLID' | |
| ) | |
| const fills = selection.map(node => node.fills[0]) | |
| const contrast = calculateContrast(fills[0].color, fills[1].color) | |
| sendContrastInfo(contrast, fills[0].color, fills[1].color) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment