---
title: "swatch.add: New Swatch… — Photo kit command — Kition"
description: "Adds a swatch of `color` (hex or a color model with values; default the foreground) named `name` to a group."
canonical: "https://developer.kition.ai/docs/kits/photo/commands/swatch.add"
---

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

# swatch.add

**New Swatch….** Adds a swatch of `color` (hex or a color model with values; default the foreground) named `name` to a group.

- Kit: Photo 0.1.0 (PSD, PSB, or .kphoto); reference: [Photo kit commands](https://developer.kition.ai/docs/kits/photo.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `coalesce` | `string` | no | Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one. |
| `color` | `string \| number[] \| object` | no | "#rrggbb"\|{"model":"rgb\|hsb\|cmyk\|lab\|gray","values":[rgb 0..255 \| hue°,s%,b% \| c%,m%,y%,k% \| L,a,b \| k%]}?=foreground; default foreground |
| `group` | `string` | no | name?=first (created when missing); created when missing; default first |
| `index` | `integer` | no | n?=end; default end |
| `kind` | `"process" \| "global" \| "spot"` | no |  |
| `name` | `string` | no | str?="Color Swatch N"; default "Color Swatch N" |

## Call through photo_run

```text
photo_run {
  "path": "<file>.psd",
  "steps": [{ "command": "swatch.add" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `coalesce`, `color`, `group`, `index`, `kind`, `name`. photo_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": {
    "coalesce": {
      "description": "Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.",
      "type": "string"
    },
    "color": {
      "description": "\"#rrggbb\"|{\"model\":\"rgb|hsb|cmyk|lab|gray\",\"values\":[rgb 0..255 | hue°,s%,b% | c%,m%,y%,k% | L,a,b | k%]}?=foreground; default foreground",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "items": {
            "type": "number"
          },
          "type": "array"
        },
        {
          "additionalProperties": true,
          "type": "object"
        }
      ]
    },
    "group": {
      "description": "name?=first (created when missing); created when missing; default first",
      "type": "string"
    },
    "index": {
      "description": "n?=end; default end",
      "type": "integer"
    },
    "kind": {
      "default": "process",
      "enum": [
        "process",
        "global",
        "spot"
      ],
      "type": "string"
    },
    "name": {
      "description": "str?=\"Color Swatch N\"; default \"Color Swatch N\"",
      "type": "string"
    }
  },
  "returns": "{name,group,index}",
  "type": "object"
}
```

Generated from the command list of @kition/photo-darwin-arm64@0.1.0 and the kit itself (photo_commands through @kition/cli@0.1.1, built from KitionAI/kition-photo@abe3f30).
