Skip to content

Instantly share code, notes, and snippets.

@marianomike
Last active May 30, 2017 04:10
Show Gist options
  • Save marianomike/b69a545043987059bf129ca76941c48c to your computer and use it in GitHub Desktop.
Save marianomike/b69a545043987059bf129ca76941c48c to your computer and use it in GitHub Desktop.
for (var k = 0; k < sharedStyles.numberOfSharedStyles(); k++){
var layerStyle = sharedStyles.objects().objectAtIndex(k);
var styleName = String(layerStyle.name());
//checks if the name of the imported color is the same as the existing
if(styleName == colorName){
var fill = layerStyle.value().fills().firstObject();
var oldFill = String("#" + fill.color().immutableModelObject().hexValue());
//checks if the existing color value is different than the imported one
if(oldFill != colorValue){
//change the fill color of the shared style
fill.color = colorFromString(colorValue);
//create a color to be added to the Document colors
var color = colorFromString(colorValue);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment