Skip to content

Instantly share code, notes, and snippets.

@danhollick
Created February 4, 2020 13:03
Show Gist options
  • Save danhollick/92898e0abfd1cc717f1f5c503fcdff2f to your computer and use it in GitHub Desktop.
Save danhollick/92898e0abfd1cc717f1f5c503fcdff2f to your computer and use it in GitHub Desktop.
figma.on('selectionchange', () => {
const fills = findFills(figma.currentPage.selection)
if (fills.length > 1) {
// ...
}
if (fills.length === 1) {
const fills = findFills(figma.currentPage.selection)
foregroundColor = getRGB(fills[0].color)
foregroundAlpha = fills[0].opacity
calculateAndSendContrast(foregroundColor, foregroundAlpha, backgoundColor)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment