Vector kit command

recolor.reduce

Reduce Colors

Groups the selection's colours into a given number of rows of similar colours and answers the proposed map, without changing anything; pass the map to recolor.apply.

Kit
Vector 0.1.0 (.kvector)
Changes the document
no

Parameters

Parameters of recolor.reduce
NameTypeRequiredDescription
colorsintegernorows; default: one per colour, with the tints of a global swatch in its row
groupstringnoread by the command beside its listed parameters
limitTostringno
mapinteger | stringnoread by the command beside its listed parameters
method"exact" | "preserveTints" | "scaleTints" | "tintsShades" | "hueShift"no
preserveobjectnoleft out of the rows
renamestringnoread by the command beside its listed parameters

Call through vector_run

text
vector_run {
  "path": "<file>.kvector",
  "steps": [{ "command": "recolor.reduce" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: colors, group, limitTo, map, method, preserve, rename. vector_run answers the step’s result in completed[i].result.

Result

Result of recolor.reduce
NameTypeRequiredDescription
mapany[]no
methodstringno
preservedstring[]no
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "map": {
      "type": "array"
    },
    "method": {
      "type": "string"
    },
    "preserved": {
      "items": {
        "type": "string"
      },
      "type": "array"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "colors": {
      "description": "rows; default: one per colour, with the tints of a global swatch in its row",
      "type": "integer"
    },
    "group": {
      "description": "read by the command beside its listed parameters",
      "type": "string"
    },
    "limitTo": {
      "type": "string"
    },
    "map": {
      "description": "read by the command beside its listed parameters",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ]
    },
    "method": {
      "enum": [
        "exact",
        "preserveTints",
        "scaleTints",
        "tintsShades",
        "hueShift"
      ],
      "type": "string"
    },
    "preserve": {
      "additionalProperties": true,
      "description": "left out of the rows",
      "properties": {
        "black": {
          "default": true,
          "type": "boolean"
        },
        "grays": {
          "default": false,
          "type": "boolean"
        },
        "white": {
          "default": true,
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "rename": {
      "description": "read by the command beside its listed parameters",
      "type": "string"
    }
  },
  "returns": "{map: [{from: [keys, the row's colour first], to: key}], preserved: [keys], method}",
  "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.