Vector kit command

swatch.library.add

Add to Swatches

Adds swatches or colour groups from a library to the document's swatches, optionally applying the first to the selection.

Kit
Vector 0.1.0 (.kvector)
Changes the document
yes

Parameters

Parameters of swatch.library.add
NameTypeRequiredDescription
applystringnolike fill; one of several alternative parameters
focusbooleannowith apply: false keeps the active proxy
librarystringno
namesany[]no[swatch or colour group names in the library] (default: all of it; a group comes as a colour group, a single swatch ungrouped); default: all of it; a group comes as a colour group, a single swatch ungrouped
strokeanynoalso apply the first one to the selection and the defaults, as paint.setFill / paint.setStroke; one of several alternative parameters

Call through vector_run

text
vector_run {
  "path": "<file>.kvector",
  "steps": [{ "command": "swatch.library.add" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: apply, focus, library, names, stroke. 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": {
    "apply": {
      "description": "like fill; one of several alternative parameters",
      "type": "string"
    },
    "focus": {
      "default": true,
      "description": "with apply: false keeps the active proxy",
      "type": "boolean"
    },
    "library": {
      "type": "string"
    },
    "names": {
      "description": "[swatch or colour group names in the library] (default: all of it; a group comes as a colour group, a single swatch ungrouped); default: all of it; a group comes as a colour group, a single swatch ungrouped",
      "items": {},
      "type": "array",
      "x-khp-name": "name",
      "x-khp-types": [
        "Swatch",
        "SwatchGroup"
      ]
    },
    "stroke": {
      "description": "also apply the first one to the selection and the defaults, as paint.setFill / paint.setStroke; one of several alternative parameters"
    }
  },
  "returns": "{library, added: [names in the document], existing: [names already there], applied?: name}",
  "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.