Copy link to clipboard
Copied
Hello, I'm using the following function below to draw some lines in photoshop.
What I'm wondering is, how does one change the color of a path before drawing it? I haven't been able to find anything on changing color for paths specifically.
function drawLine(doc, start, stop) {
var startPoint = new PathPointInfo();
startPoint.anchor = start;
startPoint.leftDirection = start;
startPoint.rightDirection = start;
startPoint.kind = PointKind.CORNERPOINT;
var stopPoint = new PathPointInfo();
stopPoint.anchor = stop;
stopPoint.leftDirection = stop;
stopPoint.rightDirection = stop;
stopPoint.kind = PointKind.CORNERPOINT;
var spi = new SubPathInfo();
spi.closed = false;
spi.operation = ShapeOperation.SHAPEXOR;
spi.entireSubPath = [startPoint, stopPoint];
var line = doc.pathItems.add("Line", [spi]);
line.strokePath(ToolType.PENCIL);
line.remove();
};
drawLine(app.activeDocument, [100,100], [200,200]);
Copy link to clipboard
Copied
Use scriptListener to record changing the path color, then you can replace the color numbers with variables to script the color change. Kind of have to do this after you draw the path and convert it to a shape.
Copy link to clipboard
Copied
Oh I didn't know about script listener. Awesome I will try that.
Thank you