Skip to content

Instantly share code, notes, and snippets.

@janily
Created May 21, 2020 11:41
Show Gist options
  • Select an option

  • Save janily/1c640ac451128f5307dbdfc8e81323bd to your computer and use it in GitHub Desktop.

Select an option

Save janily/1c640ac451128f5307dbdfc8e81323bd to your computer and use it in GitHub Desktop.
sketch props check
const sketch = require('sketch')
var doc = sketch.getSelectedDocument()
var selection = doc.selectedLayers
if (selection.length == 0) {
sketch.UI.showMessage("Please select something.");
} else {
selection.forEach(layer => {
if (layer.type == 'Text') {
var fontStyle = layer.style.fontFamily
if (fontStyle == 'Open Sans') {
sketch.UI.alert('Layer check', `Correct! The font is ${fontStyle}`)
} else {
sketch.UI.alert('Layer check', `Nope! The font is ${fontStyle}`)
}
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment