Код:
function addLabColorToSwatch(L, a, b, swatchName, swatchGroup) {
var color = new LabColor();
color.l = L;
color.a = a;
color.b = b;
try {
var swatchgroup = app.activeDocument.swatchGroups.getByName(swatchGroup);
swatchgroup.name = swatchGroup;
} catch (e) {
var swatchgroup = app.activeDocument.swatchGroups.add(swatchGroup);
swatchgroup.name = swatchGroup;
};
var newSpot = app.activeDocument.spots.add();
newSpot.name = swatchName;
newSpot.colorType = ColorModel.SPOT;
newSpot.spotKind = SpotColorKind.SPOTLAB;
newSpot.color = color;
var newSpotColor = new SpotColor();
newSpotColor.spot = newSpot;
swatchgroup.addSpot(newSpot);
return true;
}
addLabColorToSwatch(1, 2, 3, "нью ЛАБ", "ТЕСТ");