---
title: "swatch.new: New Swatch — Vector kit command — Kition"
description: "Adds swatches from a colour, a list of colours, the current fill, a gradient, a pattern or a tint, optionally global or spot and in a group."
canonical: "https://developer.kition.ai/docs/kits/vector/commands/swatch.new"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/vector/commands/swatch.new](https://developer.kition.ai/docs/kits/vector/commands/swatch.new)

# swatch.new

**New Swatch.** Adds swatches from a colour, a list of colours, the current fill, a gradient, a pattern or a tint, optionally global or spot and in a group.

- Kit: Vector 0.1.0 (.kvector); reference: [Vector kit commands](https://developer.kition.ai/docs/kits/vector.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `color` | `string` | no | one of several alternative parameters |
| `colors` | `string[]` | no | one swatch each, in one undo step; one of several alternative parameters |
| `global` | `boolean` | no |  |
| `gradient` | `any` | no | one of several alternative parameters |
| `group` | `string` | no |  |
| `keepModel` | `boolean` | no | read by the command beside its listed parameters |
| `mode` | `"gray" \| "rgb" \| "hsb" \| "lab" \| "cmyk" \| "web"` | no | convert the colour; lab: CIE L*a*b*, how spot colours are usually defined |
| `name` | `string` | no |  |
| `none` | `boolean` | no | read by the command beside its listed parameters |
| `paint` | `object` | no | read by the command beside its listed parameters |
| `pattern` | `string` | no | default: the current fill; one of several alternative parameters |
| `spot` | `boolean` | no |  |
| `swatch` | `any` | no | one of several alternative parameters |
| `tint` | `integer` | no | 0 to 100; % of the global or spot `swatch`, or of the one the current fill links to |

## Call through vector_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `color`, `colors`, `global`, `gradient`, `group`, `keepModel`, `mode`, `name`, `none`, `paint`, `pattern`, `spot`, `swatch`, `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": {
      "description": "one of several alternative parameters",
      "type": "string"
    },
    "colors": {
      "description": "one swatch each, in one undo step; one of several alternative parameters",
      "items": {
        "description": "a colour such as #rrggbb",
        "type": "string"
      },
      "type": "array"
    },
    "global": {
      "type": "boolean"
    },
    "gradient": {
      "description": "one of several alternative parameters"
    },
    "group": {
      "type": "string",
      "x-khp-name": "name",
      "x-khp-types": [
        "SwatchGroup"
      ]
    },
    "keepModel": {
      "description": "read by the command beside its listed parameters",
      "type": "boolean"
    },
    "mode": {
      "description": "convert the colour; lab: CIE L*a*b*, how spot colours are usually defined",
      "enum": [
        "gray",
        "rgb",
        "hsb",
        "lab",
        "cmyk",
        "web"
      ],
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "none": {
      "description": "read by the command beside its listed parameters",
      "type": "boolean"
    },
    "paint": {
      "additionalProperties": true,
      "description": "read by the command beside its listed parameters",
      "type": "object"
    },
    "pattern": {
      "description": "default: the current fill; one of several alternative parameters",
      "type": "string",
      "x-khp-name": "name",
      "x-khp-types": [
        "Pattern"
      ]
    },
    "spot": {
      "type": "boolean"
    },
    "swatch": {
      "description": "one of several alternative parameters",
      "x-khp-name": "name",
      "x-khp-types": [
        "Swatch",
        "Pattern"
      ]
    },
    "tint": {
      "description": "0 to 100; % of the global or spot `swatch`, or of the one the current fill links to",
      "type": "integer"
    }
  },
  "returns": "{name, names: [every new swatch]}",
  "type": "object"
}
```

Generated from the command list of @kition/vector-darwin-arm64@0.1.0 and the kit itself (vector_commands through @kition/cli@0.1.1, built from KitionAI/kition-vector@7cf908f).
