Skip to content

Commit

Permalink
textColor 赋值使用 MSImmutableColor
Browse files Browse the repository at this point in the history
1. 使用 MSColor 会导致 Sketch 48 发生闪退
2. 删除了替换成功提示文案末尾的“\r\n”,之前会让消息产生空行,显得很不美观
  • Loading branch information
PBBB authored Dec 8, 2017
1 parent 33df053 commit 79d886f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WeSketch.sketchplugin/Contents/Sketch/colorReplace.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function colorReplace(context) {
}
if ('#' + textcolor.hexValue() == colorToFind) {
replaceCount++;
layer.textColor = MSColor.colorWithRed_green_blue_alpha(colorToReplace.r / 255, colorToReplace.g / 255, colorToReplace.b / 255, 1.0);
layer.textColor = MSImmutableColor.colorWithRed_green_blue_alpha(colorToReplace.r / 255, colorToReplace.g / 255, colorToReplace.b / 255, 1.0);
}
}

Expand Down Expand Up @@ -269,7 +269,7 @@ function colorReplace(context) {
}

if (replaceCount) {
context.document.showMessage('替换成功,共找到' + replaceCount + '处\r\n');
context.document.showMessage('替换成功,共找到' + replaceCount + '处');
} else {
context.document.showMessage('没有找到需要替换的颜色');
}
Expand All @@ -279,4 +279,4 @@ function colorReplace(context) {

var onRun = function (context) {
colorReplace(context);
}
}

0 comments on commit 79d886f

Please sign in to comment.