跳转到内容

GrayColor

new GrayColor()

灰度颜色规范,用于需要 Color 对象的场景。


grayColor.gray

灰色的色调。

范围:0.0 到 100.0,其中 0.0 是黑色,100.0 是白色。

数字(双精度)。


grayColor.typename

引用对象的类名。

字符串;只读。


// 将活动文档中第一个单词的颜色设置为灰色
if (app.documents.length > 0 && app.activeDocument.textFrames.length > 0) {
var text = app.activeDocument.textFrames[0].textRange;
var firstWord = text.words[0];
// 创建新颜色
var textColor = new GrayColor();
textColor.gray = 45;
firstWord.filled = true;
firstWord.fillColor = textColor;
}