Last active
May 30, 2017 04:08
-
-
Save marianomike/d4960ced946dcb7f68a98f9135629056 to your computer and use it in GitHub Desktop.
This file contains 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
var sketch = context.api(); | |
var doc = sketch.selectedDocument; | |
var sharedStyles = doc.sketchObject.documentData().layerStyles(); | |
var numberOfSharedStyles = Number(sharedStyles.numberOfSharedStyles()); | |
//create array to hold existing styles for reference later | |
var existingStyles = []; | |
//if there are exisitng styles push them to array | |
if(numberOfSharedStyles > 0){ | |
for (var i = 0; i < sharedStyles.numberOfSharedStyles(); i++){ | |
layerStyle = sharedStyles.objects().objectAtIndex(i); | |
var styleName = String(layerStyle.name()); | |
existingStyles.push(styleName); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment