File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed
Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments