Recolor Artwork: a Color Groups list selects, saves, adds and deletes color groups

The dialog lists the document's color groups on its right, or under
the tabs in a narrow window, and the Show Color Groups button beside
the tabs shows or hides the list. A click on a group makes it the
group being edited: with art, the art is reduced again to a row per
color of the group, which become the rows' new colors; without art,
the rows are the group's colors. Save Changes rewrites the selected
group with the colors OK would give it and the name in the name
field, New Color Group saves the rows' new colors as a new group, and
Delete removes the selected group. Each is its own undo step, and the
Swatches panel shows it.

When the art has colors of the group, Save Changes keeps the group's
swatches in order: a swatch whose color a row lists takes that row's
new color, and the others keep theirs. After a save with art the rows'
new colors take the Global Adjust, which goes back to 0%, and when the
save recolored linked art the rows are read from the art again.

The dialog fields are group, groupStorage and groupAction (save, new
or delete). A name no group has, a groupAction of another value, and
save or delete with no group selected are refused.

swatch.editGroup given a group's own colors in order and no new name
records no undo step.
This commit is contained in:
dotCooCoo
2026-11-15 07:43:03 -08:00
parent 0c1ac3bdc5
commit 6635cd7748
7 changed files with 856 additions and 19 deletions
+4 -1
View File
@@ -290,7 +290,10 @@ luminosity}`, percent from -100 to 100, 0 by default). The dialog sends a non-ze
colors; colors opened alone are saved as a group with the change. `display` sets how the Edit tab shows the new
colors: `smooth` (the smooth wheel, also when unset; each opening starts there), `segmented` (a wheel of solid patches,
24 hues by 5 saturations, whose markers move as freely) or `bars` (a solid bar per recolored color in row order; a click
selects its row for the sliders and a drag moves the row without changing a color). Setting
selects its row for the sliders and a drag moves the row without changing a color). `groupStorage` shows the Color
Groups list (true when the dialog opens); setting `group` to a color group's name makes it the group being edited,
as opening on it does, and refuses a name no group has; `groupAction` (`save`, `new` or `delete`) runs the list's Save
Changes, New Color Group or Delete button on the next frame, or first on confirm (see `docs/mcp.md`). Setting
`colors`, a preserve flag or `limitTo` reduces the rows again (also on `ui.dialog.confirm`). The dialog previews
`recolor.apply` on the canvas; confirm keeps it as one undo step (with a group, the group is rewritten in the same
step; with no art selected only the group changes). In the Swatches panel, double-clicking a colour group's folder,
+26 -1
View File
@@ -4337,7 +4337,8 @@ the others turn by the same hue). `limitTo` snaps new colours to a swatch librar
`exclude: true` keeps its colours. With `limitTo`, a row's `tint` (a percentage, default 100) gives the art
linked to the global or spot swatch its new color is that share of its tint; `tint` must be a number. `recolor.randomize`
moves a row's `tint` with its new color and removes it from a color it changes, and moves a row's `model` with its new color. `swatch.editGroup {group, colors, rename?}` rewrites a colour group in one undo
step (art linked to its global swatches follows), and `recolor.apply` with `group` recolours the art and rewrites the
step (art linked to its global swatches follows); given the group's own colors in order and no new name, it records no
undo step. And `recolor.apply` with `group` recolours the art and rewrites the
group together. Art linked to one of the group's global swatches stays linked when the swatch is rewritten with its
row's new color (the default without `groupColors` when the rows follow the group's order), so a later `swatch.edit` still
reaches it; the reply's `relinked` counts the other linked paints that took the group's new colors. Art in a row that
@@ -4404,6 +4405,30 @@ become the `weights` field, which moves the rows' current colors and previews th
beside the link button runs `swatch.newGroup` right away, as its own undo step: Save All Colors saves the new colors
of the rows that are not excluded, in row order, and Save Prominent Colors saves the bar's colors in the bar's order.
The Recolor Artwork dialog lists the document's color groups on its right, or under the tabs in a window too narrow
for both ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html)).
The Show Color Groups button beside the tabs shows or hides the list (the `groupStorage` field, true when the dialog
opens). A click on a group, or `ui.dialog.set` of the `group` field to a group's name, makes it the group being
edited: with art the art is reduced again to a row per color of the group, which become the rows' new colors, and
without art the rows are the group's colors. A name that no group has is refused with `` no colour group `<name>` ``,
and a `group` of null selects none. The buttons under the list are the `groupAction` field. Setting it checks the value, and the next frame of the
dialog runs it (OK with it set in the same request runs it first):
`save` (Save Changes) runs `swatch.editGroup` on the selected group with the colors OK would give it and the name in
`groupName`, `new` (New Color Group) saves the new colors of the rows that are not excluded as `swatch.newGroup` does,
and `delete` (Delete) runs `swatch.delete` on the selected group. Each is its own undo step, and the art keeps its
preview. When the art has colors of the group, `save` keeps the group's swatches in order: a swatch whose color a row
lists takes that row's new color (its own color when the row is excluded), so art linked to the swatch takes the color
its row shows, and every other swatch keeps its color. After a `save` with art, the rows' new colors take the Global
Adjust and it goes back to 0%; when the save recolored linked art, the rows are read from the art again and a row with a
color the save gave the art is excluded, also when other art has that color, since a row recolors every use of its
colors alike. Until the rows or the Global Adjust change, OK changes the saved group only by the name
in `groupName`. `save` and `delete` with no group selected answer `` missing `group` ``, and any other value is
refused. After a Delete without art, OK saves the rows as a new color group.
```json
{"name":"answer_dialog","arguments":{"set":[{"field":"group","value":"Brights"},{"field":"groupAction","value":"save"}]}}
```
```json
{"name":"run_command","arguments":{"command":"recolor.weigh","params":{"map":[{"from":["rgb 255 0 0","rgb 128 0 204"],"to":"#00ff00"},{"from":["rgb 0 0 255"],"to":"#ffff00"}],"weights":[1,1]}}}
```
+1
View File
@@ -1591,6 +1591,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Document Color Mode for effects and graphs:** File › Document Color Mode and `document.open {colorMode}` convert the colors of effects (Drop Shadow, Inner Glow, Outer Glow and the other effects with a color, on objects, their fills and strokes and in graphic styles) and the series paints and label styles that a graph keeps, so a graph drawn again from new data keeps the converted colors; File › Document Color Mode also converts the fill and stroke that new art takes. Undo restores the original new-art fill and stroke and Redo applies the conversion again.
- **Recolor Artwork layout (#3416):** the Edit chip list uses the modal scroll helper and its actual remaining height; the tab's minimum-height space scrolls with the chips. `tests_recolor` covers 5/20/200/400 colors, window resizing, 100/125/150/200% UI scaling, scrolling to and editing the final chip, Preview, Cancel, Confirm and Undo, alongside the existing #1733 drag regressions. Scores and estimates unchanged.
- **Recolor Artwork Edit displays:** buttons beside the Edit tab's wheel show the colors on a smooth color wheel, a segmented color wheel or as color bars ([Edit colors using Recolor Artwork](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/edit-colors-using-edit-colors-dialog.html)). The segmented wheel draws 24 hues by 5 saturations as solid patches, and its markers move freely as on the smooth wheel. The bars show one solid bar per recolored color in row order: a click selects a bar for the color sliders, and a drag moves its row without changing a color ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html)). The dialog opens on the smooth wheel; `display` (`smooth`, `segmented`, `bars`) is the dialog field. `tests_recolor` covers switching, the dialog height, segmented dragging and Brightness, and bar selection, editing, reordering, scrolling, Preview, Cancel and OK. Scores and estimates unchanged.
- **Recolor Artwork color groups list:** a list on the right of the dialog shows the document's color groups, and the Show Color Groups button beside the tabs shows or hides it. A click on a group makes it the group being edited, and the rows take its colors. Save Changes rewrites the selected group with the new colors, New Color Group saves them as a new group, and Delete removes the selected group; the Swatches panel shows each change ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html)). `group`, `groupStorage` and `groupAction` are the dialog fields. Tests: `the_color_groups_list_selects_saves_and_deletes_groups` and `a_group_picked_in_the_list_recolors_the_art` in `crates/ui-egui/src/dialogs/recolor.rs`, and `edit_color_group_with_its_own_colors_records_no_undo_step` in `crates/engine/src/tests/swatchcmds.rs`.
- **Edit Colors parameters:** `edit.colors.saturate` needs a number `intensity`, the value from -100% to 100% that Saturate takes ([Adjusting colors](https://web.archive.org/web/20230128232631/https://helpx.adobe.com/illustrator/using/adjusting-colors.html)), and answers "missing number `intensity`" without one; a number outside the range counts as its nearest end. A value that is not a number, such as `"40"`, is refused with `` `intensity` must be a number, not "40" ``, as in every command that needs a number (`tests::params::a_malformed_required_number_is_not_reported_as_missing`). `edit.colors.adjustBalance` refuses a channel and `color.harmony` refuses `steps` or `amount` that is not a number; both read `null` as a value left out. `tests::editcolors` and `tests::colorguide` cover them.
- **Convert to Indexed Color:** Edit › Edit Colors › Convert to Indexed Color… (`edit.colors.toIndexed`) stores the embedded images in the selection as indexed-color PNGs of at most 256 colors. The palette is chosen as for a PNG-8 export, as evenly spaced levels of red, green and blue, or from the document's swatches, with diffusion, pattern or noise dithering; pixels under half opacity become transparent. The dialog previews live, and OK is one undo step. This is VectorCraft's own command and counts toward no score. `tests::editcolors` and `encode::tests_palette` cover it. Scores and estimates unchanged.
- **Working RGB numeric controls:** the Color panel and Color Picker read RGB, HSB, hex and Web Safe RGB values in the active working RGB space. Editing one RGB channel preserves the other native channels, including colors outside display sRGB. Regressions cover sRGB, Display P3, Wide Gamut RGB and ProPhoto RGB, picker initialization, native numeric round trips, and a slider click with one Undo step. Scores and estimates unchanged.