Recolor: Save Changes leaves excluded rows' color, swatch and tint as they are

bake_adjust gave every row the Global Adjust and, with no library
limit, removed every row's picked swatch and tint, excluded rows
included. An excluded row recolors no art, so it now keeps its new
color, swatch and tint, and the other rows still take the adjustment.
This commit is contained in:
dotCooCoo committed 2026-12-03 00:10:08 -08:00
1 parent bba32dd27c
commit c738e2e6aa
3 files changed
+21 -4

No files matched your search

+19 -2
View File
@@ -64,7 +64,8 @@
//! Swatches panel shows. 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 (its own color
//! when the row is excluded), and every other swatch keeps its color. After a save with art the
//! rows' new colors take the Global Adjust, which goes back to 0%. When the save recolors art
//! rows' new colors take the Global Adjust, which goes back to 0%; an excluded row keeps its new
//! color, swatch and tint. When the save recolors art
//! linked to the group's global swatches, the rows are read from the art again (a color the save
//! gave the art is excluded, and a color the art had before keeps its row's new color). Until the
//! rows or the Global Adjust change, OK changes the saved group only by its name. After a Delete
@@ -931,7 +932,8 @@ fn bake_adjust(app: &VectorcraftApp, d: &mut Fields) {
}
let mut rs = rows(d);
let suppresses_links = d.str("limitTo").is_empty();
for r in &mut rs {
// An excluded row recolors no art, so it keeps its new color, swatch and tint.
for r in rs.iter_mut().filter(|r| !excluded(r)) {
if to_color(r).is_some()
&& let Some(c) = group_colors(app, d, std::iter::once(&*r)).into_iter().next()
{
@@ -4944,6 +4946,21 @@ mod tests {
assert_eq!(new_shown(&app, &d, &links, &row), red);
}
/// Save Changes bakes the Global Adjust into the rows that recolor art only: an excluded row
/// keeps its new color, its picked swatch and its tint.
#[test]
fn baking_the_global_adjust_leaves_excluded_rows_as_they_are() {
let app = app(100);
let row = json!({"from": ["rgb 128 128 128"], "to": "cmyk 0 100 0 0", "swatch": {"name": "Ink", "library": "document"}, "tint": 40.0, "exclude": true});
let mut d = Fields::new(
json!({"globalAdjust": {"brightness": -50}, "limitTo": "", "rows": [row.clone(), {"from": ["rgb 255 0 0"], "to": "rgb 255 0 0"}]}),
);
bake_adjust(&app, &mut d);
let rs = super::rows(&d);
assert_eq!(rs[0], row, "the excluded row is unchanged: {}", rs[0]);
assert_ne!(rs[1]["to"], json!("rgb 255 0 0"), "the other row takes the adjustment: {}", rs[1]);
}
/// A row picked from a global process swatch shows the swatch's own color, which the art takes,
/// not the row's color key, which rounds it.
#[test]
+1 -1
View File
@@ -6930,7 +6930,7 @@ before an excluded row or one that removes the color, as `recolor.apply` maps th
a row's new color, 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. A row whose color was removed (`to: null`) and is not excluded
removes its swatch, and the colors added on the Edit tab follow the group's other colors, as at OK. 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
Adjust and it goes back to 0% (an excluded row keeps its new color, swatch and tint); 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` ``. `save` on a group with a
+1 -1
View File
@@ -2191,7 +2191,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Recolor Artwork Add Color and Remove Color tools:** under the display buttons beside the Edit tab's wheel, the Add Color tool adds the color clicked on either wheel to the color group, and the Remove Color tool removes the color whose marker is clicked; a color bar's right-click menu has Remove Color, and the base color can't be removed ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html), [Edit swatch groups using the color wheel](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/edit-color-groups-using-the-color-wheel.html)). An added color is a new row with no current colors and `added: true`; unlike a row made with New Row, it adds its new color to a rewritten color group, after the group's other colors. VectorCraft's own rules: an added color takes the base color's brightness, and with art or a group a removed color's row stays with its current colors and no new color, so that art keeps its colors and the group's swatch at that place is removed. `wheelTool` (`add`, `remove`) is the dialog field. Tests: `the_add_color_tool_adds_a_row_with_no_current_colors`, `an_added_color_joins_the_color_group`, `the_remove_color_tool_removes_a_marker_but_not_the_base_colors` and `a_color_bars_menu_removes_its_color` in `crates/ui-egui/src/tests/recolor.rs`, `apply_params_give_the_group_added_colors_and_keep_its_other_colors` in `crates/ui-egui/src/dialogs/recolor.rs`, and `an_added_empty_row_gives_the_group_its_color_after_the_others` in `crates/engine/src/tests/recolor.rs`. Scores and estimates unchanged.
- **Recolor Artwork brightness and hue wheel:** a button under the Edit tab's wheel tools switches the wheel between hue with saturation and hue with brightness; a marker's angle sets its hue, and its distance from the center sets the component the wheel shows ([Recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/recolor-options-overview.html), [archived help, Edit colors](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=144)). VectorCraft's own rules: brightness runs from black at the center to full at the edge, the segmented wheel's five rings become brightness steps, the slider under the wheel edits the component the wheel leaves out (Saturation on the brightness wheel), Add Color takes the hue and brightness clicked at the base color's saturation, the choice holds for both wheels while the dialog is open and the button is off for the color bars, and each opening shows hue and saturation. `wheelAxes` (`hueSaturation`, `hueBrightness`) is the dialog field. Tests: `the_brightness_and_hue_wheel_swaps_the_wheel_axis_and_the_slider`, `a_marker_on_the_brightness_wheel_sets_hue_and_brightness`, `the_add_color_tool_on_the_brightness_wheel_adds_the_brightness_clicked` and `the_segmented_brightness_wheel_has_24_hues_by_5_brightnesses` in `crates/ui-egui/src/tests/recolor.rs`, and `an_added_color_on_the_brightness_wheel_takes_the_base_colors_saturation` in `crates/ui-egui/src/dialogs/recolor.rs`. Scores and estimates unchanged.
- **Recolor Artwork Find:** the Assign tab's Find button finds the colors of the selected rows in the art ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html)): while it is on, their art shows as the preview shows it and the rest of the selected art shows dimmed, until a second click ([archived help, Recolor Artwork](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=149)). VectorCraft's own rules: a dimmed color is a 25% tint of its current color (or the nearest lighter tint when that one is a color a selected row lists), a color a selected row also lists is not dimmed, and Find records no undo step. `findColors` is the dialog field. Tests: `find_dims_the_colors_of_the_rows_not_selected` and `find_shows_the_selected_rows_art_and_dims_the_rest` in `crates/ui-egui/src/dialogs/recolor.rs`. 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)). VectorCraft's own rules: when the art has colors of the group, Save Changes and OK keep the group's swatches in order, and a swatch no row lists keeps its color; an excluded row leaves its swatch its own color; after a save with art, the rows' new colors take the Global Adjust, which goes back to 0%. `group`, `groupStorage` and `groupAction` are the dialog fields. Tests: `the_color_groups_list_selects_saves_and_deletes_groups`, `a_group_picked_in_the_list_recolors_the_art` and the `saving_a_group_` tests in `crates/ui-egui/src/dialogs/recolor.rs`, and `edit_color_group_with_its_own_colors_records_no_undo_step` and `edit_color_group_with_its_own_color_keys_keeps_the_colors` in `crates/engine/src/tests/swatchcmds.rs`.
- **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)). VectorCraft's own rules: when the art has colors of the group, Save Changes and OK keep the group's swatches in order, and a swatch no row lists keeps its color; an excluded row leaves its swatch its own color; after a save with art, the rows' new colors take the Global Adjust, which goes back to 0%, and an excluded row keeps its new color, swatch and tint. `group`, `groupStorage` and `groupAction` are the dialog fields. Tests: `the_color_groups_list_selects_saves_and_deletes_groups`, `a_group_picked_in_the_list_recolors_the_art` and the `saving_a_group_` tests in `crates/ui-egui/src/dialogs/recolor.rs`, and `edit_color_group_with_its_own_colors_records_no_undo_step` and `edit_color_group_with_its_own_color_keys_keeps_the_colors` in `crates/engine/src/tests/swatchcmds.rs`.
- **Recolor Artwork New Row:** the Assign tab's New Row button adds a row with no current colors, so current colors can be moved into it and take its new color ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html), [Assign new colors to selected artworks](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/assign-new-colors-to-selected-artwork.html)). VectorCraft's own rules: the row goes above the first selected row (at the top when none is selected) with that row's new color and becomes the selection, and Merge with it as the first selected row moves the other rows' colors into it. The button needs selected art. An empty row recolors nothing, does not count toward Colors, adds no library swatch and gives a rewritten color group no color. While it is empty, Save All Colors and a new color group saved from colors alone leave its new color out, the Edit tab's wheel, bars and chips do not show it and its sliders edit the base color instead, the harmony rules and linked moves leave its new color as it is, and the Color Theme Picker gives it no color. Tests: `a_new_row_goes_above_the_selection_and_takes_merged_colors`, `an_empty_row_gives_the_group_no_color`, `an_empty_row_gives_a_new_group_no_color`, `an_empty_row_takes_no_harmony_or_wheel_color`, `theme_picks_leave_an_empty_row_out`, `save_all_colors_leaves_an_empty_row_out` and `colors_merged_into_a_new_row_take_its_new_color` in `crates/ui-egui/src/dialogs/recolor.rs`, `an_empty_row_recolors_nothing` and `an_empty_row_adds_no_swatch_and_no_group_color` in `crates/engine/src/tests/recolor.rs`.
- **Recolor Artwork Undo Changes and Redo Changes:** two buttons beside the Color Theme Picker go back and forward one color edit made in the open dialog, and Undo Changes has nothing to undo after the dialog is opened again ([Recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/recolor-options-overview.html)); `ui.recolorUndo` and `ui.recolorRedo` run them. VectorCraft's own rules: the dialog's history is separate from the document's, which changes when OK records one undo step and when Save All Colors or Save Prominent Colors adds a color group at once as its own undo step, which Cancel and Undo Changes leave in place; a drag is one step, fields set with `ui.dialog.set` before the next frame with the pointer up or the next step are one step, Reset is a step of its own, a new edit leaves nothing to redo, selecting another color group or Save Changes leaves nothing to undo or redo and an edit after either is a step back to the fields as they were then, a button with no step to go to is disabled, and the dialog keeps at most 64 steps and 4 MiB of them, always keeping the newest step. Tests: `undo_and_redo_changes_step_through_the_dialogs_own_edits`, `a_drag_is_one_step_of_undo_changes`, `undo_changes_reverses_reset`, `the_recolor_undo_and_redo_commands_step_the_open_dialog`, `the_recolor_undo_and_redo_commands_preview_the_step`, `an_edit_with_the_pointer_down_from_the_first_frame_is_a_step` and `rows_and_weights_set_before_the_art_is_read_are_no_step` in `crates/ui-egui/src/tests/recolor.rs`, and `undo_changes_keeps_a_bounded_history` and `another_group_or_save_changes_leaves_nothing_to_undo` and `an_edit_right_after_another_group_is_a_step` and `an_unchanged_save_changes_leaves_nothing_to_redo` in `crates/ui-egui/src/dialogs/recolor.rs`. Scores and estimates unchanged.
- **Recolor Artwork: a swatch picked for a row stays that swatch:** a row's new color is changed in the Color Picker ([Assign new colors to selected artworks](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/assign-new-colors-to-selected-artwork.html)), Scale Tints gives a row's lighter current colors lighter tints of its new color, and Preserve Tints gives a spot or global current color's tint to the new color ([CS5 help, Colorize Method](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=151), [2021 reference, Colorize Method](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=252)). VectorCraft's own rule: a spot or global swatch picked in the Color Picker's swatch list for a row of the selected art stays that swatch, unless an earlier solid swatch (other than a linked tint) in the same library has the same name and color, so the row's art takes tints of it linked to it, also with no Limit to Library, and editing the swatch recolors the art; a process swatch gives its color as before, the row drops the swatch when its new color changes, and a swatch deleted after the pick links nothing, nor does a global swatch of the color group being rewritten that takes another color, and with Limit to Library the library's swatch of that color is used instead. `recolor.apply` rows take `swatch: {name, library?}`. Tests: `a_swatch_picked_for_a_row_links_the_art_to_it_without_a_library`, `a_process_library_swatch_hides_the_tint_of_a_rows_own_spot_swatch`, `a_rows_spot_swatch_rewritten_with_another_color_shows_no_tint`, `a_library_spot_swatch_rewritten_with_another_color_shows_no_tint` and `a_library_swatch_named_like_a_rewritten_group_swatch_keeps_its_tint` in `crates/ui-egui/src/tests/recolor.rs`, `a_picked_spot_swatch_gives_its_row_the_tint_slider`, `a_picked_swatch_that_is_gone_links_nothing` and `a_picked_swatch_the_group_rewrites_shows_the_full_color` in `crates/ui-egui/src/dialogs/recolor.rs`, and `a_rows_swatch_links_its_art_without_limit_to_library`, `a_rows_swatch_with_a_finer_color_than_its_key_still_links`, `a_rows_swatch_in_the_rewritten_group_keeps_the_rows_new_color` and `a_rows_library_swatch_joins_the_document_and_a_process_swatch_changes_nothing` in `crates/engine/src/tests/recolor.rs`. Scores and estimates unchanged.