Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textColor 赋值使用 MSImmutableColor #53

Merged
merged 1 commit into from
Dec 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
textColor 赋值使用 MSImmutableColor
1. 使用 MSColor 会导致 Sketch 48 发生闪退
2. 删除了替换成功提示文案末尾的“\r\n”,之前会让消息产生空行,显得很不美观
  • Loading branch information
PBBB committed Dec 8, 2017
commit 79d886fbd3c5bcc1af2d5149d40ca3dbfa8a98e2
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);
}
}