---
title: "text.characterStyle.new: New Character Style — Photo kit command — Kition"
description: "Creates a character style (font, size, color and other character attributes) from `attrs` or the selected text (`fromSelection`), optionally applying it; answers its id."
canonical: "https://developer.kition.ai/docs/kits/photo/commands/text.characterStyle.new"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/photo/commands/text.characterStyle.new](https://developer.kition.ai/docs/kits/photo/commands/text.characterStyle.new)

# text.characterStyle.new

**New Character Style.** Creates a character style (font, size, color and other character attributes) from `attrs` or the selected text (`fromSelection`), optionally applying it; answers its id.

- 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 |
| --- | --- | --- | --- |
| `apply` | `boolean` | no |  |
| `at` | `number[]` | no | Instead of `layer`: a point [x, y] in image pixels; the command acts on the topmost visible layer, not fully locked, with a pixel there (the Move tool's Auto-Select). |
| `attrs` | `object` | no | "size_pt":36,"font_family":"Inter","align":"Center",…; "size":36,"font":"Inter","color":"#rrggbb","align":"center",… |
| `coalesce` | `string` | no | Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one. |
| `fromSelection` | `boolean` | no | start from the targeted text's formatting |
| `layer` | `integer \| string` | no | The layer: its id as inspect lists it, "#n" (the n-th layer of the image's top level as inspect lists it, counted from the top: "#1" is the top one), or its whole name when no other layer has it; the active layer by default. |
| `layers` | `integer[]` | no | default: the selected type layers; one of several alternative parameters |
| `name` | `string` | no |  |
| `range` | `number[]` | no | [startChar, endChar]; one layer; default all text |

## Call through photo_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `apply`, `at`, `attrs`, `coalesce`, `fromSelection`, `layer`, `layers`, `name`, `range`. 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": {
    "apply": {
      "default": false,
      "type": "boolean"
    },
    "at": {
      "description": "Instead of `layer`: a point [x, y] in image pixels; the command acts on the topmost visible layer, not fully locked, with a pixel there (the Move tool's Auto-Select).",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "attrs": {
      "additionalProperties": true,
      "description": "\"size_pt\":36,\"font_family\":\"Inter\",\"align\":\"Center\",…; \"size\":36,\"font\":\"Inter\",\"color\":\"#rrggbb\",\"align\":\"center\",…",
      "type": "object"
    },
    "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"
    },
    "fromSelection": {
      "default": true,
      "description": "start from the targeted text's formatting",
      "type": "boolean"
    },
    "layer": {
      "description": "The layer: its id as inspect lists it, \"#n\" (the n-th layer of the image's top level as inspect lists it, counted from the top: \"#1\" is the top one), or its whole name when no other layer has it; the active layer by default.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-index": "#",
      "x-khp-index-order": "reversed",
      "x-khp-name": "name",
      "x-khp-types": [
        "Layer"
      ]
    },
    "layers": {
      "description": "default: the selected type layers; one of several alternative parameters",
      "items": {
        "description": "an id",
        "type": "integer"
      },
      "type": "array"
    },
    "name": {
      "type": "string"
    },
    "range": {
      "description": "[startChar, endChar]; one layer; default all text",
      "items": {
        "type": "number"
      },
      "type": "array"
    }
  },
  "returns": "{\"id\",\"name\"}",
  "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).
