色板
app.activeDocument.swatches[index]
文档中包含的颜色色板定义。色板对应于 Illustrator 用户界面中的色板面板。
脚本可以创建一个新的色板。
色板可以保存所有类型的颜色数据,例如图案、渐变、CMYK、RGB、灰度和专色。
Swatch.color
Section titled “Swatch.color”app.activeDocument.swatches[index].color
此色板的颜色信息。
Swatch.name
Section titled “Swatch.name”app.activeDocument.swatches[index].name
色板的名称。
字符串。
Swatch.parent
Section titled “Swatch.parent”app.activeDocument.swatches[index].parent
包含此色板的对象。
文档; 只读。
Swatch.typename
Section titled “Swatch.typename”app.activeDocument.swatches[index].typename
对象的类名。
字符串; 只读。
Swatch.remove()
Section titled “Swatch.remove()”app.activeDocument.swatches[index].remove()
删除此对象。
无。
// 更改最后一个色板的名称if ( app.documents.length > 0 && app.activeDocument.swatches.length > 0 ) { var lastIndex = app.activeDocument.swatches.length - 1; var lastSwatch = app.activeDocument.swatches[lastIndex]; lastSwatch.name = "TheLastSwatch";}