swap_color
Find and replace a color across an After Effects project, previewing matches with a dry run before applying swaps to solids, shape fills, strokes, text, or effect colors.
Instructions
Find/replace a color across the project — the client brand-color-change primitive. from/to accept a hex string ("#rrggbb"/"#rgb") or an [r,g,b(,a)] array (0–1 or 0–255, auto-normalized). A color matches when every RGB channel is within tolerance (0–1 per-channel, default 0.02) of from. dryRun defaults to TRUE — it reports every match WITHOUT changing anything; pass dryRun:false to apply. scope limits to one comp (name or id); omit for the whole project. include selects which color surfaces to touch (solids, shapeFill, shapeStroke, textFill, effectColor); omit for all. Setting a SOLID recolors every layer sharing that footage item (swapped once, flagged shared:true, called out in note). Keyframed colors are matched but SKIPPED (setValue would delete keys). Returns { from, to, tolerance, matches:[{comp, layer, surface, was, ...}], matchCount, swapped, dryRun, note? }.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"from": "<from>",
"to": "<to>"
},
"name": "swap_color"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Replacement color: hex or [r,g,b(,a)]. | |
| from | Yes | Color to find: hex or [r,g,b(,a)]. | |
| scope | No | Comp (name, id, or { id: N }) to limit the swap to. Omit for whole project. | |
| dryRun | No | Report matches without changing (default true). | |
| include | No | Color surfaces to include. Omit for all. | |
| instance | No | Target a specific AE when more than one is connected (e.g. "2026", "2025", or a major like "26"). Omit when only one AE is open — see list_instances. | |
| tolerance | No | Per-channel RGB match tolerance (0–1). |