Skip to content

Commit 3e800b5

Browse files
committed
updates for Sketch 41
1 parent 8fc4ef9 commit 3e800b5

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

Contents/Sketch/colors.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ var applyColors = function (newColors, assetColors) {
33
var appController = app.delegate();
44
var colors = [];
55
for(var i=0; i<newColors.length; i++) {
6-
var color = MSColor.colorWithSVGString("#" + newColors[i].Rgb);
7-
color.alpha = newColors[i].Opacity;
6+
var color = MSImmutableColor.colorWithSVGString("#" + newColors[i].Rgb);
7+
if(newColors[i].Opacity) {
8+
color.alpha = newColors[i].Opacity;
9+
}
810
colors.push(color);
911
}
1012
[assetColors addColors:colors];
1113

1214
// The following line is throwing the error: is not a function
1315
// appController.globalAssets().objectDidChange();
14-
16+
1517
}

Contents/Sketch/styles.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,26 @@ var applyStyles = function (newStyles, sharedStyles) {
2020

2121
if(style.Background) {
2222
var fill = sharedStyle.addStylePartOfType(alignmentHash['fill']);
23-
fill.color = MSColor.colorWithSVGString("#" + style.Background);
23+
fill.color = MSImmutableColor.colorWithSVGString("#" + style.Background);
2424
}
2525

2626
if(style.Borderthickness > 0 && style.Bordercolor) {
2727
var borders = sharedStyle.addStylePartOfType(alignmentHash['border']);
2828
borders.thickness = style.Borderthickness;
29-
borders.color = MSColor.colorWithSVGString("#" + style.Bordercolor);
29+
borders.color = MSImmutableColor.colorWithSVGString("#" + style.Bordercolor);
3030
}
3131

3232
if(style.Shadow) {
3333
var shadow = sharedStyle.addStylePartOfType(alignmentHash['shadow']);
34-
var shadowColor = MSColor.colorWithSVGString("#" + style.Shadowcolor);
35-
shadow.color = shadowColor.colorWithAlpha(style.Shadowopacity);
34+
var shadowColor = MSImmutableColor.colorWithSVGString("#" + style.Shadowcolor);
35+
shadow.color = shadowColor.colorWithAlphaComponent(style.Shadowopacity);
3636
setShadowAttribute(shadow, style.Shadow);
3737
}
3838

3939
if(style.Innershadow) {
4040
var innerShadow = sharedStyle.addStylePartOfType(alignmentHash['innerShadow']);
41-
var innerShadowColor = MSColor.colorWithSVGString("#" + style.Innershadowcolor);
42-
innerShadow.color = innerShadowColor.colorWithAlpha(style.Innershadowopacity);
41+
var innerShadowColor = MSImmutableColor.colorWithSVGString("#" + style.Innershadowcolor);
42+
innerShadow.color = innerShadowColor.colorWithAlphaComponent(style.Innershadowopacity);
4343
setShadowAttribute(innerShadow, style.Innershadow);
4444
}
4545

Contents/Sketch/typography.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var applyTypography = function (newStyles, sharedStyles) {
3939
if("Alignment" in style) { textLayer.setTextAlignment(alignmentEnum[style.Alignment]); }
4040
if("Typeface" in style) { textLayer.setFontPostscriptName(style.Typeface); }
4141
if("Color" in style) {
42-
var color = MSColor.colorWithSVGString("#" + style.Color);
42+
var color = MSImmutableColor.colorWithSVGString("#" + style.Color);
4343
color.alpha = style.Opacity;
4444
textLayer.setTextColor(color);
4545
}

0 commit comments

Comments
 (0)