# Light (glow)

> The arguments, limits, result and refusals of resident.glow and pixling resident glow.

`resident.glow` plays a one-shot light effect across one resident, without speech. Specify which pixels to light, their color, and the shape as a single step or a chain of up to 8 steps totaling at most 10 seconds. Pixling plays the light once and forgets it: there is no loop, no saved state, and nothing to read back.

For when to use light alongside messages, states, and sequences, see [Build expression](/docs/connect/expression/).

## MCP: `pixling_resident_glow`

`to` is required and must resolve to exactly one resident on the desk (`auto` and `everyone` are refused).

Provide either one step with its keys flat at the root, or `steps` (an array of 1–8 step objects with the same keys, without `to`). Providing both fails with `invalidArguments`.

| Key | Values | Default |
| --- | --- | --- |
| `select` | `"all"`, `{"colors": [...]}`, `{"groups": [...]}`, or `{"points": [...]}` | `"all"` |
| `color` | `"source"` (brighten each pixel's color) or `#RRGGBB` | `"source"` |
| `shape` | `pulse`: soft swell; `sweep`: directed wave; `blink`: three short flashes | `sweep` |
| `direction` | `left-to-right`, `right-to-left`, `top-to-bottom`, `bottom-to-top`, or `center-out` | `left-to-right` |
| `durationMs` | Integer `334`–`10000` (`blink` minimum `1002`; list sum max `10000`) | `1010` |

### Selection and coordinate rules

- **`"all"`**: Lights every opaque pixel.
- **`colors`**: 1–16 `#RRGGBB` values. Lights pixels whose displayed color (after the resident's color settings) or source color matches any listed hex value.
- **`groups`**: 1–16 `#RRGGBB` values. Lights every color in each color group containing a listed source color. Nearby colors merge into at most 16 groups; `resident.describe` lists them in `sequence.palette` as `{color, share, colors}` (largest area first), and `resident sketch --colors` uses the same groups. Pass a group's `color`.
- **`points`**: 1–64 unique `{"x", "y"}` points. Source pixel coordinates with the origin at the canvas top-left. Use `resident.pixels` to inspect the palette and coordinates.
- **Strict hex colors**: Colors must be exact `#RRGGBB`, with no surrounding whitespace, no 3-digit shorthand, and no alpha channel.
- **Direction and duration**: `direction` is valid only with `sweep` and is refused with any other shape. `blink` requires `durationMs` of at least `1002` (at most three flashes per second), and steps in a `steps` list sum to at most `10000`.
- **Unmirrored canvas frame**: Directions and points refer to the canvas before mirroring and rotation.

```json title="Example payloads"
{"to":"No.7#1","select":"all","shape":"pulse","durationMs":800}

{"to":"No.7#1","select":{"colors":["#FF0000"]},"color":"#FFFFFF","shape":"sweep","direction":"top-to-bottom"}

{"to":"No.7#1","steps":[
  {"select":{"points":[{"x":2,"y":3},{"x":8,"y":4}]},"shape":"blink","durationMs":1200},
  {"select":"all","color":"#66CCFF","shape":"sweep","direction":"center-out","durationMs":1500}
]}
```

## Result and refusals

Success returns `{entityID, accepted: true}`. This confirms acceptance, not that the user saw the effect. Enabling Reduce Motion afterward, showing the full-color `original` representation, or an on-screen change can still hide it, so there is no `played` field.

When the light cannot play at call time, Pixling returns `rejected` with a `detail` code and a `hint`:

| `detail` | Cause |
| --- | --- |
| `notOnDesk` | The resident is not on the desk. |
| `wallpaperPinned` | The resident is pinned to the wallpaper. |
| `deskOff` | Pixling's desk is turned off. |
| `hidden` | The resident is hidden. |
| `sequenceRunning` | A sequence currently owns the resident. |
| `reduceMotion` | macOS Reduce Motion is turned on. |
| `asleep` | The Mac is asleep or locked, or the display is off. |
| `arranging` | The user is rearranging residents. |
| `held` | The user is holding or adjusting the resident. |
| `notVisible` | The resident is not visible right now (for example, on another desktop). |
| `notDrawn` | No pixel-art frame is currently on screen to light. |

- **Shared refusal vocabulary**: [`resident.emote` and `resident.throw`](/docs/reference/residents/#pixling_resident_emote-and-pixling_resident_throw) share these refusal codes. Unlike `resident.glow`, `resident.emote` plays a fade-only version under Reduce Motion and follows the body while a sequence runs.
- **No speech or saved state**: A light involves no speech and saves nothing (see [Effects and retries](/docs/connect/effects/)).
- **Compatible representations**: Works while an indexed animation or a volume look is showing. On a volume look, light appears on its front pixel face.
- **Binding rules**: Writes to a bound resident follow the standard [binding rules](/docs/connect/own-a-resident/).

## CLI: `pixling resident glow`

| Flag | Argument |
| --- | --- |
| `--to SELECTOR` | `to` |
| `--select all\|colors\|groups\|points` | `select` (omitted, inferred from `--color-of` or `--point`, or `all` when neither is given). |
| `--color-of '#RRGGBB'` (repeat 1–16 times) | Colors for `select.colors`, or for `select.groups` when combined with `--select groups`. |
| `--point X,Y` (repeat 1–64 times) | `select.points`. |
| `--color source\|'#RRGGBB'` | `color`. |
| `--shape pulse\|sweep\|blink` | `shape`. |
| `--direction …` | `direction` (`sweep` only). |
| `--duration-ms N` | `durationMs`. |
| `--steps-json '<JSON array>'` | `steps` (at most 8 steps and 64 KiB). |

Combining `--steps-json` with one-step flags, or `--color-of` with `--point`, is a usage error (exit `64`).

With `--json`, output is the `resident.glow` document, and a `rejected` refusal exits with `5`. Human output prints the document's `hint` when no dedicated message exists.

```sh title="Terminal"
pixling resident glow --to 'No.7#1' --shape pulse --duration-ms 800
pixling resident glow --to 'No.7#1' --color-of '#FF0000' --color '#FFFFFF' --direction top-to-bottom
pixling resident glow --to 'No.7#1' --point 2,3 --point 8,4 --shape blink
pixling resident glow --to 'No.7#1' --steps-json '[
  {"select":{"points":[{"x":2,"y":3}]},"shape":"blink","durationMs":1200},
  {"select":"all","color":"#66CCFF","shape":"sweep","direction":"center-out","durationMs":1500}]'
```

> [!NOTE]
> **No legacy arrival keys or flags**
> `resident.glow` refuses `glowMs`, `glowPoints`, `glowDirection`, and `glowColor` as unknown keys, and `pixling resident glow` does not accept `--glow-ms`, `--glow-point`, `--glow-direction`, or `--glow-color`. `message.send` (`pixling message send`) keeps its own `glowMs` / `--glow-ms` and `glowPoints` / `--glow-point` arrival options.

## Related

- [Sequences](/docs/reference/sequences/): Sync frame-timed lights with motion clips, movement, emotes, and bounces.
- [Residents](/docs/reference/residents/): Inspect pixel palettes, sketch frames, and trigger emotes or throws.
