var myDocument = app.documents.add();
var myTextFrame = myDocument.textFrames.add();
usercolor("COLOR_RED", 0, 100,100,0);
var COLOR_RED =myDocument.swatches.getByName("COLOR_RED").color;
//var COLOR_RED = usercolor("COLOR_RED", 0, 100,100,0);
var COLOR_GRAY = usercolor("COLOR_GRAY", 0, 0, 0, 50);
var newcolor4 = usercolor("newcolor4", 100, 100, 0, 0);
//рисуем объекты
var obj1 = myDocument.pathItems.polygon (50, 188, 72.0, 5);
parametrShape(obj1, true, COLOR_RED, true, COLOR_RED, true, true)
var obj2 = myDocument.pathItems.polygon (150, 288, 72.0, 6);
parametrShape(obj2, true, COLOR_GRAY, true, COLOR_GRAY, true, true, )
function parametrShape(obj, strok, strcolor, filled, fillcolor, strOver, fillOver)
{
obj.stroked = strok;
obj.strokeColor = strcolor;
obj.filled = filled;
obj.strokeOverprint = strOver;
obj.fillOverprint = fillOver ;
obj.fillColor = fillcolor;
}
// конструктор цвета
function usercolor(name, cyan, magenta, yellow, black) {
var UserSwatch = app.activeDocument.swatches.add()
UserSwatch.name = name;
UserSwatch.color = new CMYKColor;
UserSwatch.color.cyan = cyan;
UserSwatch.color.magenta = magenta;
UserSwatch.color.yellow = yellow;
UserSwatch.color.black = black;
return UserSwatch.color;
}