---
title: "paint.editGradient: Gradient — Vector kit command — Kition"
description: "Sets or edits the gradient on the fill or stroke of the selection: kind (linear, radial, freeform), stops, angle and aspect."
canonical: "https://developer.kition.ai/docs/kits/vector/commands/paint.editGradient"
---

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

# paint.editGradient

**Gradient.** Sets or edits the gradient on the fill or stroke of the selection: kind (linear, radial, freeform), stops, angle and aspect.

- Kit: Vector 0.1.0 (.kvector); reference: [Vector kit commands](https://developer.kition.ai/docs/kits/vector.md)
- Changes the document: yes
- Acts on: `ids` (a list of ids), which a run step’s `on` fills

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `angle` | `number` | no | degrees |
| `aspect` | `number` | no | percent |
| `id` | `integer` | no | object ID |
| `ids` | `integer[]` | no | object IDs |
| `item` | `integer \| null` | no |  |
| `kind` | `"linear" \| "radial" \| "freeform"` | no | freeform places points on each object, coloured along the stops |
| `mode` | `"points" \| "lines"` | no | freeform: how the Gradient tool adds points |
| `reverse` | `boolean` | no |  |
| `stops` | `object[]` | no | [{offset 0..1, color? (needed without swatch), opacity? 0..1 (or 0..100), midpoint? 0.13..0.87, swatch?: colour swatch name (a global or spot colour or tint swatch links the stop, so swatch edits recolour it and a spot stop prints on its plate; a process colour just gives its colour), tint?: 0..100 (% of the linked swatch; default 100, or a tint swatch's own)}] (at least 2; a freeform gradient's points are recoloured along them); needed without swatch; or 0..100; a global or spot colour or tint swatch links the stop, so swatch edits recolour it and a spot stop prints on its plate; a process colour just gives its colour; % of the linked swatch; default 100, or a tint swatch's own; at least 2; a freeform gradient's points are recoloured along them |
| `stroke` | `boolean` | no | default: the targeted item's kind, else the active proxy |
| `strokeMode` | `"within" \| "along" \| "across"` | no | strokes only: the gradient lies on the page and shows through the stroke, runs from the start of each subpath to its end, or runs from the stroke's left edge to its right all along it; with nothing selected, for the next object drawn; type characters' own strokes always paint within |
| `target` | `string` | no | "object" (default) or "contents": the objects themselves, or what their groups and layers hold |

## Call through vector_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `angle`, `aspect`, `id`, `ids`, `item`, `kind`, `mode`, `reverse`, `stops`, `stroke`, `strokeMode`, `target`. 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": {
    "angle": {
      "description": "degrees",
      "type": "number"
    },
    "aspect": {
      "description": "percent",
      "type": "number"
    },
    "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"
        }
      ]
    },
    "kind": {
      "description": "freeform places points on each object, coloured along the stops",
      "enum": [
        "linear",
        "radial",
        "freeform"
      ],
      "type": "string"
    },
    "mode": {
      "description": "freeform: how the Gradient tool adds points",
      "enum": [
        "points",
        "lines"
      ],
      "type": "string"
    },
    "reverse": {
      "type": "boolean"
    },
    "stops": {
      "description": "[{offset 0..1, color? (needed without swatch), opacity? 0..1 (or 0..100), midpoint? 0.13..0.87, swatch?: colour swatch name (a global or spot colour or tint swatch links the stop, so swatch edits recolour it and a spot stop prints on its plate; a process colour just gives its colour), tint?: 0..100 (% of the linked swatch; default 100, or a tint swatch's own)}] (at least 2; a freeform gradient's points are recoloured along them); needed without swatch; or 0..100; a global or spot colour or tint swatch links the stop, so swatch edits recolour it and a spot stop prints on its plate; a process colour just gives its colour; % of the linked swatch; default 100, or a tint swatch's own; at least 2; a freeform gradient's points are recoloured along them",
      "items": {
        "additionalProperties": true,
        "properties": {
          "color": {
            "type": "string"
          },
          "swatch": {
            "description": "colour swatch name",
            "x-khp-name": "name",
            "x-khp-role": "object",
            "x-khp-types": [
              "Swatch"
            ]
          },
          "tint": {
            "description": "0 to 100",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "stroke": {
      "description": "default: the targeted item's kind, else the active proxy",
      "type": "boolean"
    },
    "strokeMode": {
      "description": "strokes only: the gradient lies on the page and shows through the stroke, runs from the start of each subpath to its end, or runs from the stroke's left edge to its right all along it; with nothing selected, for the next object drawn; type characters' own strokes always paint within",
      "enum": [
        "within",
        "along",
        "across"
      ],
      "type": "string"
    },
    "target": {
      "description": "\"object\" (default) or \"contents\": the objects themselves, or what their groups and layers hold",
      "type": "string"
    }
  },
  "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).
