Skip to content

Instantly share code, notes, and snippets.

@janily
Last active June 16, 2020 01:12
Show Gist options
  • Select an option

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

Select an option

Save janily/c5595f6067028fb4a4d6517379877608 to your computer and use it in GitHub Desktop.
get selection style
let sketch = require('sketch')
let doc = sketch.getSelectedDocument()
let selection = doc.selectedLayers.layers[0] //basic rect layer
let randomRadius = Math.round((Math.random()*100))
console.log("randomRadius: " + randomRadius)
selection.points.forEach(point => point.cornerRadius = randomRadius)
selection.sketchObject.setFixedRadius(randomRadius)
console.log(selection.sketchObject.CSSAttributes())let sketch = require('sketch')
let doc = sketch.getSelectedDocument()
let selection = doc.selectedLayers.layers[0] //basic rect layer
let randomRadius = Math.round((Math.random()*100))
console.log("randomRadius: " + randomRadius)
selection.points.forEach(point => point.cornerRadius = randomRadius)
selection.sketchObject.setFixedRadius(randomRadius)
console.log(selection.sketchObject.CSSAttributes())
let sketch = require('sketch')
let doc = sketch.getSelectedDocument()
let selection = doc.selectedLayers.layers[0]
console.log(selection.type)
// 'SymbolInstance'
console.log(selection.style.fills)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment