PathStyle is used for changing the visual styles of items contained within an Illustrator document and is returned by item.style and document.currentStyle.
All properties of PathStyle are also reflected directly in Item, i.e.: item.fillColor.
To set multiple style properties in one go, you can pass an object to item.style. This is a convenient way to define a style once and apply it to a series of items:
var circleStyle = {
fillColor: new RGBColor(1, 0, 0),
strokeColor: new GrayColor(1),
strokeWidth: 5
};
var path = new Path.Circle(new Point(50, 50), 50);
path.style = circleStyle;
Properties
- Returns:
- String ('even-odd', 'non-zero')
The output resolution for the path.
- Returns:
- Number
Stroke Style
The color of the stroke.
Sample code:
// Create a circle shaped path at { x: 50, y: 50 } with a radius of 10:
var circle = new Path.Circle(new Point(50, 50), 10);
// Set the stroke color of the circle to CMYK red:
circle.strokeColor = new CMYKColor(1, 1, 0, 0);
- Returns:
- Color
The width of the stroke.
Sample code:
// Create a circle shaped path at { x: 50, y: 50 } with a radius of 10:
var circle = new Path.Circle(new Point(50, 50), 10);
// Set the stroke width of the circle to 3pt:
circle.strokeWidth = 3;
- Returns:
- Number
The cap of the stroke.
Sample code:
// Create a line from { x: 0, y: 50 } to { x: 50, y: 50 };
var line = new Path.Line(new Point(0, 50), new Point(50, 50));
// Set the stroke cap of the line to be round:
line.strokeCap = 'round';
- Returns:
- String ('butt', 'round', 'square')
The join of the stroke.
- Returns:
- String ('miter', 'round', 'bevel')
The dash offset of the stroke.
- Returns:
- Number
Specifies an array containing the dash and gap lengths of the stroke.
Sample code:
// Create a line from { x: 0, y: 50 } to { x: 50, y: 50 };
var line = new Path.Line(new Point(0, 50), new Point(50, 50));
line.strokeWidth = 3;
// Set the dashed stroke to [10pt dash, 5pt gap, 8pt dash, 10pt gap]:
line.dashArray = [10, 5, 8, 10];
- Returns:
- Array of Number
The miter limit controls when the program switches from a mitered (pointed) join to a beveled (squared-off) join. The default miter limit is 4, which means that when the length of the point reaches four times the stroke weight, the program switches from a miter join to a bevel join. A miter limit of 0 results in a bevel join.
- Returns:
- Number — the miter limit as a value between 0 and 500
Specifies whether to overprint the stroke. By default, when you print opaque, overlapping colors, the top color knocks out the area underneath. You can use overprinting to prevent knockout and make the topmost overlapping printing ink appear transparent in relation to the underlying ink.
- Returns:
- Boolean — true if the stroke is overprinted, false otherwise
Fill Style
Specifies whether to overprint the fill. By default, when you print opaque, overlapping colors, the top color knocks out the area underneath. You can use overprinting to prevent knockout and make the topmost overlapping printing ink appear transparent in relation to the underlying ink.
- Returns:
- Boolean — true if the fill is overprinted, false otherwise