🐟️ 功能,按当前文件的色盘中专色,建立专色色标

源码 AI脚本绘制专色色标.jsx
var doc = app.activeDocument;
var currentLayer = doc.activeLayer;
var mm = 25.4 / 72;
var myFont = textFonts.getByName("MicrosoftYaHei");
var white = new CMYKColor();
var xOffset = 0;
var yOffset = 0;
var blockWidth = 120;
var blockHeight = 30;
var spacing = 10;
var excludedColorName = "[套版色]";
for (var i = 0; i < doc.swatches.length; i++) {
var swatch = doc.swatches[i];
if (swatch.color.typename === "SpotColor" && swatch.name !== excludedColorName) {
var rect = currentLayer.pathItems.rectangle(yOffset, xOffset, blockWidth, blockHeight);
rect.fillColor = swatch.color;
var txt = currentLayer.textFrames.add();
txt.contents = swatch.name;
txt.top = yOffset - 2;
txt.left = xOffset + 3;
txt.textRange.fillColor = white;
txt.textRange.characterAttributes.textFont = myFont;
xOffset += blockWidth + spacing;
if (xOffset > doc.width - blockWidth) {
xOffset = 0;
yOffset -= (blockHeight + spacing + 15);
}
}
}