Vector kit command
paint.setStroke
Stroke
Sets the stroke paint of the selection or ids (or the default stroke) to a colour, a swatch, a gradient, a pattern or none; use stroke.set for weight and dashes.
- Kit
- Vector 0.1.0 (.kvector)
- Changes the document
- yes
- Acts on
ids(a list of ids), which a run step’sonfills
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
color | string | number[] | object | no | |
focus | boolean | no | false keeps the active proxy |
gradient | object | no | {kind?: linear|radial|freeform, stops?: [{offset 0..1, color, opacity? 0..1 (or 0..100), midpoint? 0.13..0.87, swatch?: global or spot colour (or tint) swatch the stop links to (its colour comes from the swatch), tint?: 0..100}] (at least 2; default white→black), angle?: deg, start?: [x,y], end?: [x,y] (the vector in document coordinates, both or neither; type objects keep it in text space), aspect?: % (radial; without start/end the gradient is placed on each object's bounds), focal?: [x,y] (radial, with start/end: the focal point, where the first stop sits), swatch?: linked gradient swatch name}; or 0..100; or tint; its colour comes from the swatch; at least 2; default white→black; the vector in document coordinates, both or neither; type objects keep it in text space; radial; without start/end the gradient is placed on each object's bounds; radial, with start/end: the focal point, where the first stop sits |
id | integer | no | object ID |
ids | integer[] | no | object IDs |
item | integer | null | no | |
keepModel | boolean | no | in a CMYK document, RGB colours and gradient stops are stored as CMYK unless true; Gray stays Gray |
none | boolean | no | |
paint | object | no | read by the command beside its listed parameters |
swatch | string | no | a global or spot colour stays linked, so swatch edits recolour it; a tint swatch links to its base at its tint; a gradient swatch is recorded as the gradient's swatch and fits each object, keeping its aspect; the built-in "[Registration]" prints on every plate |
target | string | no | "object" (default) or "contents": the objects themselves, or what their groups and layers hold |
tint | integer | no | 0 to 100; % of a global or spot `swatch`; default 100, or a tint swatch's own |
Call through vector_run
text
vector_run {
"path": "<file>.kvector",
"steps": [{ "command": "paint.setStroke" }]
}The required parameters, with placeholders for their types: not a tested example. Optional: color, focus, gradient, id, ids, item, keepModel, none, paint, swatch, target, tint. vector_run answers the step’s result in completed[i].result.
Result
The kit gives no result schema for this command.
Parameter schema
json
{
"additionalProperties": false,
"properties": {
"color": {
"oneOf": [
{
"type": "string"
},
{
"items": {
"type": "number"
},
"type": "array"
},
{
"additionalProperties": true,
"type": "object"
}
]
},
"focus": {
"default": true,
"description": "false keeps the active proxy",
"type": "boolean"
},
"gradient": {
"additionalProperties": true,
"description": "{kind?: linear|radial|freeform, stops?: [{offset 0..1, color, opacity? 0..1 (or 0..100), midpoint? 0.13..0.87, swatch?: global or spot colour (or tint) swatch the stop links to (its colour comes from the swatch), tint?: 0..100}] (at least 2; default white→black), angle?: deg, start?: [x,y], end?: [x,y] (the vector in document coordinates, both or neither; type objects keep it in text space), aspect?: % (radial; without start/end the gradient is placed on each object's bounds), focal?: [x,y] (radial, with start/end: the focal point, where the first stop sits), swatch?: linked gradient swatch name}; or 0..100; or tint; its colour comes from the swatch; at least 2; default white→black; the vector in document coordinates, both or neither; type objects keep it in text space; radial; without start/end the gradient is placed on each object's bounds; radial, with start/end: the focal point, where the first stop sits",
"properties": {
"angle": {
"description": "degrees",
"type": "number"
},
"aspect": {
"description": "percent",
"type": "number"
},
"end": {
"items": {
"type": "number"
},
"type": "array"
},
"focal": {
"items": {
"type": "number"
},
"type": "array"
},
"kind": {
"enum": [
"linear",
"radial",
"freeform"
],
"type": "string"
},
"start": {
"items": {
"type": "number"
},
"type": "array"
},
"stops": {
"description": "[{offset 0..1, color, opacity? 0..1 , midpoint? 0.13..0.87, swatch?: global or spot colour swatch the stop links to , tint?: 0..100}]",
"items": {
"additionalProperties": true,
"properties": {
"color": {
"type": "string"
},
"swatch": {
"description": "global or spot colour swatch the stop links to",
"x-khp-name": "name",
"x-khp-role": "object",
"x-khp-types": [
"Swatch"
]
},
"tint": {
"description": "0 to 100",
"type": "integer"
}
},
"type": "object"
},
"type": "array"
},
"swatch": {
"description": "linked gradient swatch name",
"x-khp-name": "name",
"x-khp-role": "object",
"x-khp-types": [
"Swatch"
]
}
},
"type": "object"
},
"id": {
"description": "object ID",
"type": "integer",
"x-khp-types": [
"Node"
]
},
"ids": {
"description": "object IDs",
"items": {
"type": "integer"
},
"type": "array",
"x-khp-types": [
"Node"
]
},
"item": {
"oneOf": [
{
"type": "integer"
},
{
"type": "null"
}
]
},
"keepModel": {
"default": false,
"description": "in a CMYK document, RGB colours and gradient stops are stored as CMYK unless true; Gray stays Gray",
"type": "boolean"
},
"none": {
"default": true,
"type": "boolean"
},
"paint": {
"additionalProperties": true,
"description": "read by the command beside its listed parameters",
"type": "object"
},
"swatch": {
"description": "a global or spot colour stays linked, so swatch edits recolour it; a tint swatch links to its base at its tint; a gradient swatch is recorded as the gradient's swatch and fits each object, keeping its aspect; the built-in \"[Registration]\" prints on every plate",
"type": "string",
"x-khp-name": "name",
"x-khp-types": [
"Swatch",
"Pattern"
]
},
"target": {
"description": "\"object\" (default) or \"contents\": the objects themselves, or what their groups and layers hold",
"type": "string"
},
"tint": {
"description": "0 to 100; % of a global or spot `swatch`; default 100, or a tint swatch's own",
"type": "integer"
}
},
"returns": "black), angle?: deg, start?: [x,y], end?: [x,y] (the vector in document coordinates, both or neither; type objects keep it in text space), aspect?: % (radial; without start/end the gradient is placed on each object's bounds), focal?: [x,y] (radial, with start/end: the focal point, where the first stop sits), swatch?: linked gradient swatch name}, item?: appearance item index|null (omitted: the Appearance panel's active item if it is a stroke, else the top stroke), ids?, focus?: true (false keeps the active proxy), keepModel?: false (in a CMYK document, RGB colours and gradient stops are stored as CMYK unless true; Gray stays Gray)} sets the selection's stroke and the default",
"type": "object"
}Generated from the command list of @kition/[email protected] and the kit itself (vector_commands through @kition/[email protected], built from KitionAI/kition-vector@7cf908f). As data: commands.jsonl.