From f7b7ca5f86e5339a4db2e86520a2ab2590ad0dd4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 06:37:59 -0800 Subject: [PATCH 1/6] Recolor with Preset: ask whether to limit colors to a swatch library first Edit > Edit Colors > Recolor with Preset (1, 2 and 3 Color Job, Color Library) now opens a Recolor with Preset dialog with a Limit to Library menu (None, Document Swatches or a library) before Recolor Artwork opens; OK opens Recolor Artwork with the preset's colors and that library, and Cancel opens nothing. The menu items run ui.recolorDialog {preset: true}. A 1 Color Job limited to the document's swatches, with a spot or global ink picked for its row, gives gray art tints of that ink linked to its swatch, so editing the swatch recolors the art. Opening either dialog over another dialog now ends that dialog as Cancel does, so a Recolor Artwork preview is rolled back. --- crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/dialogs.rs | 2 + crates/ui-egui/src/dialogs/recolor.rs | 45 +++-- crates/ui-egui/src/dialogs/recolor_preset.rs | 77 ++++++++ crates/ui-egui/src/menus/tree.rs | 8 +- crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/tests/recolor.rs | 184 +++++++++++++++++++ docs/control-protocol.md | 7 +- docs/target-app-parity.md | 1 + 9 files changed, 308 insertions(+), 20 deletions(-) create mode 100644 crates/ui-egui/src/dialogs/recolor_preset.rs diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index c3dbf78293..18951b9c90 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -995,7 +995,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.recolorDialog", "Recolor Artwork…", "", - "{colors?: n (an n-colour job: n rows, Scale Tints) | [colour] (new colours to assign, in order; with no art selected and no group they are the rows, and OK saves them as a new colour group, field `groupName`: the Color Guide's Edit or Apply Colors), library?: id or name; or \"document\" (Limit to Library; \"\" the first library), group?: colour group (Edit or Apply Color Group: OK rewrites the group with the new colours and recolours the selected art, if any)} open Recolor Artwork (dialog `recolor`; engine: recolor.reduce / recolor.apply)", + "{colors?: n (an n-colour job: n rows, Scale Tints) | [colour] (new colours to assign, in order; with no art selected and no group they are the rows, and OK saves them as a new colour group, field `groupName`: the Color Guide's Edit or Apply Colors), library?: id or name; or \"document\" (Limit to Library; \"\" the first library), group?: colour group (Edit or Apply Color Group: OK rewrites the group with the new colours and recolours the selected art, if any), preset?: bool (Recolor with Preset: first open the `recolorPreset` dialog, whose Limit to Library field `limitTo` starts on `library`; its OK opens Recolor Artwork with `colors` and that library)} open Recolor Artwork (dialog `recolor`; engine: recolor.reduce / recolor.apply)", ), ( "ui.recolorUndo", diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index a24755ab12..0376bf83f3 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -113,6 +113,7 @@ mod psd_options; pub mod raster_effects; pub mod rearrange_artboards; pub mod recolor; +pub mod recolor_preset; mod recovery; pub mod relink; pub mod rename_artboards; @@ -337,6 +338,7 @@ registry! { ArtboardOptions: [artboard_options::KIND] => artboard_options::SPEC, ExportForScreens: ["exportForScreens"] => export_for_screens::SPEC, Recolor: [recolor::KIND] => recolor::SPEC, + RecolorPreset: [recolor_preset::KIND] => recolor_preset::SPEC, Command: ["command"] => command::SPEC, Variables: [variables::KIND] => variables::SPEC, Effect: ["effect"] => effect::SPEC, diff --git a/crates/ui-egui/src/dialogs/recolor.rs b/crates/ui-egui/src/dialogs/recolor.rs index 1b80ce5e35..2901c69bd9 100644 --- a/crates/ui-egui/src/dialogs/recolor.rs +++ b/crates/ui-egui/src/dialogs/recolor.rs @@ -192,6 +192,11 @@ const COMPS: &str = "__comps"; /// rows, which OK saves as a new colour group); `library` limits to a library or "document" ("" /// picks the first library). pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { + match p.get("preset") { + None | Some(Value::Bool(false)) => {} + Some(Value::Bool(true)) => return super::recolor_preset::open(app, p), + Some(_) => return Err("`preset` must be true or false".into()), + } let st = app.session.active().ok_or("no document open")?; let art = !st.selection.is_empty(); let group = p.get("group").and_then(Value::as_str); @@ -217,11 +222,7 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { None if !assign.is_empty() => json!(assign.len()), None => Value::Null, }; - let limit = match p.get("library").and_then(Value::as_str) { - Some("") => first_library(app).unwrap_or_default(), - Some(l) => limit_key(app, l)?, - None => String::new(), - }; + let limit = library_param(app, p)?; // Without art the rows are the group's colours, as they are. let mut start: Vec = if art { vec![] } else { assign.iter().map(|k| json!({"from": [k], "to": k})).collect() }; number_slots(&mut start); @@ -241,6 +242,10 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { snap(app, &d, &mut rs); d.fields.insert("rows".into(), Value::Array(rs)); // Undo Changes has nothing to undo on a new opening. + // A dialog this one replaces ends as Cancel ends it, its preview rolled back. + if app.ui.dialog.is_some() { + super::cancel(app); + } app.ui.recolor_history = History { opened: Some(snapshot(&d)), ..History::default() }; app.ui.dialog = Some(d); Ok(Value::Null) @@ -253,6 +258,27 @@ fn key(c: &Color) -> Value { /// The name a new colour group (opened on colours alone) starts with. const NEW_GROUP: &str = "Color Group"; +/// Limit to Library's choices, as keys of `limitTo` and the names shown: None, the document's +/// swatches, then the colour libraries: the built-in ones (at the top level of the library menu) +/// translated, those the user saved or loaded by their names. +pub(super) fn library_choices(app: &VectorcraftApp) -> (Vec, Vec) { + let libs = colour_libraries(app); + let keys = ["", swatchlib::DOCUMENT_SWATCHES].into_iter().map(String::from).chain(libs.iter().map(|l| l.id.clone())).collect(); + let names: Vec<&str> = ["None", DOCUMENT_SWATCHES].into_iter().chain(libs.iter().map(|l| l.name.as_str())).collect(); + let builtin = |k: usize| k.checked_sub(2).is_none_or(|i| libs.get(i).is_some_and(|l| l.submenu.is_none())); + let shown = super::shown_names(crate::i18n::current(), &names, builtin).into_iter().map(String::from).collect(); + (keys, shown) +} + +/// The `limitTo` key of `ui.recolorDialog`'s `library` (none without it, the first library for ""). +pub(super) fn library_param(app: &VectorcraftApp, p: &Value) -> Result { + match p.get("library").and_then(Value::as_str) { + Some("") => Ok(first_library(app).unwrap_or_default()), + Some(l) => limit_key(app, l), + None => Ok(String::new()), + } +} + fn first_library(app: &VectorcraftApp) -> Option { colour_libraries(app).into_iter().next().map(|l| l.id) } @@ -1956,13 +1982,8 @@ fn assign_tab(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog, rows: &mut } ui.end_row(); ui.label(egui::RichText::new(tl!("Limit to Library:")).color(t.text_dim)); - // None, the document's swatches, then the colour libraries: the built-in ones (at the top - // level of the library menu) translated, those the user saved or loaded by their names. - let libs = colour_libraries(app); - let keys: Vec<&str> = ["", swatchlib::DOCUMENT_SWATCHES].into_iter().chain(libs.iter().map(|l| l.id.as_str())).collect(); - let names: Vec<&str> = ["None", DOCUMENT_SWATCHES].into_iter().chain(libs.iter().map(|l| l.name.as_str())).collect(); - let builtin = |k: usize| k.checked_sub(2).is_none_or(|i| libs.get(i).is_some_and(|l| l.submenu.is_none())); - let shown = super::shown_names(crate::i18n::current(), &names, builtin); + let (keys, shown) = library_choices(app); + let shown: Vec<&str> = shown.iter().map(String::as_str).collect(); let cur = d.str("limitTo"); let at = keys.iter().position(|k| *k == cur).unwrap_or(0); let current = shown.get(at).copied().unwrap_or_default(); diff --git a/crates/ui-egui/src/dialogs/recolor_preset.rs b/crates/ui-egui/src/dialogs/recolor_preset.rs new file mode 100644 index 0000000000..a9063c8945 --- /dev/null +++ b/crates/ui-egui/src/dialogs/recolor_preset.rs @@ -0,0 +1,77 @@ +//! Edit → Edit Colors → Recolor with Preset: before Recolor Artwork opens on a preset (an n-color +//! job or Color Library), this dialog asks whether to limit the new colors to a swatch library +//! (`ui.recolorDialog {preset: true, colors?, library?}`). OK opens Recolor Artwork with the +//! preset's colors and the library chosen (None: no limit); Cancel opens nothing. +//! +//! Fields: `colors` (the preset's count, null for Color Library) and `limitTo` (a library id, +//! `"document"` for the document's swatches, `""` for None), as Recolor Artwork's. + +use serde_json::{Value, json}; + +use super::DialogSpec; +use super::recolor::{library_choices, library_param}; +use super::swatch_options::{grid, label}; +use crate::state::Dialog; +use crate::{VectorcraftApp, widgets}; + +/// The dialog kind of Recolor with Preset. +pub const KIND: &str = "recolorPreset"; + +pub(super) const SPEC: DialogSpec = + DialogSpec { heading: |_| tl!("Recolor with Preset").into(), body, confirm, min_width: 340.0, ..DialogSpec::FORM }; + +/// Open the dialog for the preset of `p` (`colors`: a count; `library`: the library it starts on, +/// "" the first library) on the selected art. +pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { + let st = app.session.active().ok_or("no document open")?; + if st.selection.is_empty() { + return Err("select artwork to recolor".into()); + } + let colors = count(p.get("colors"))?; + let limit = library_param(app, p)?; + // A dialog this one replaces ends as Cancel ends it, its preview rolled back. + if app.ui.dialog.is_some() { + super::cancel(app); + } + app.ui.dialog = Some(Dialog::new(KIND, json!({"colors": colors, "limitTo": limit}))); + Ok(Value::Null) +} + +/// The preset's count of new colors: none for Color Library, else at least 1. +fn count(v: Option<&Value>) -> Result { + match v { + None | Some(Value::Null) => Ok(Value::Null), + Some(n) => Ok(json!(n.as_u64().filter(|n| *n >= 1).ok_or("`colors` must be a count of at least 1")?)), + } +} + +fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { + let (keys, shown) = library_choices(app); + let shown: Vec<&str> = shown.iter().map(String::as_str).collect(); + let cur = d.str("limitTo"); + let at = keys.iter().position(|k| *k == cur).unwrap_or(0); + let current = shown.get(at).copied().unwrap_or_default(); + grid(ui, |ui| { + label(ui, tl!("Limit to Library:")); + let library = ui.name_inputs(tl!("Limit to Library:"), |ui| widgets::dropdown_names(ui, "recolor-preset-library", current, &shown, 200.0)); + if let Some(k) = library.and_then(|i| keys.get(i)) { + d.fields.insert("limitTo".into(), json!(k)); + } + ui.end_row(); + }); + false +} + +fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { + let mut p = serde_json::Map::new(); + let n = count(d.fields.get("colors"))?; + if !n.is_null() { + p.insert("colors".into(), n); + } + let limit = d.str("limitTo"); + if !limit.is_empty() { + p.insert("library".into(), json!(limit)); + } + // Recolor Artwork takes the dialog's place; when it cannot open, this dialog stays. + super::recolor::open(app, &Value::Object(p)) +} diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs index 3e68b98c92..c0f10056cc 100644 --- a/crates/ui-egui/src/menus/tree.rs +++ b/crates/ui-egui/src/menus/tree.rs @@ -109,10 +109,10 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec)> { sub( "Recolor with Preset", vec![ - cp("1 Color Job…", "ui.recolorDialog", json!({"colors": 1})), - cp("2 Color Job…", "ui.recolorDialog", json!({"colors": 2})), - cp("3 Color Job…", "ui.recolorDialog", json!({"colors": 3})), - cp("Color Library…", "ui.recolorDialog", json!({"library": ""})), + cp("1 Color Job…", "ui.recolorDialog", json!({"colors": 1, "preset": true})), + cp("2 Color Job…", "ui.recolorDialog", json!({"colors": 2, "preset": true})), + cp("3 Color Job…", "ui.recolorDialog", json!({"colors": 3, "preset": true})), + cp("Color Library…", "ui.recolorDialog", json!({"library": "", "preset": true})), ], ), c("Adjust Color Balance…", "ui.colorBalanceDialog"), diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index d2c72aae40..27bcf98155 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -996,7 +996,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.recolorDialog", "Recolor Artwork…", "", - "{colors?: n (an n-colour job: n rows, Scale Tints) | [colour] (new colours to assign, in order; with no art selected and no group they are the rows, and OK saves them as a new colour group, field `groupName`: the Color Guide's Edit or Apply Colors), library?: id or name; or \"document\" (Limit to Library; \"\" the first library), group?: colour group (Edit or Apply Color Group: OK rewrites the group with the new colours and recolours the selected art, if any)} open Recolor Artwork (dialog `recolor`; engine: recolor.reduce / recolor.apply)", + "{colors?: n (an n-colour job: n rows, Scale Tints) | [colour] (new colours to assign, in order; with no art selected and no group they are the rows, and OK saves them as a new colour group, field `groupName`: the Color Guide's Edit or Apply Colors), library?: id or name; or \"document\" (Limit to Library; \"\" the first library), group?: colour group (Edit or Apply Color Group: OK rewrites the group with the new colours and recolours the selected art, if any), preset?: bool (Recolor with Preset: first open the `recolorPreset` dialog, whose Limit to Library field `limitTo` starts on `library`; its OK opens Recolor Artwork with `colors` and that library)} open Recolor Artwork (dialog `recolor`; engine: recolor.reduce / recolor.apply)", ), ( "ui.recolorUndo", diff --git a/crates/ui-egui/src/tests/recolor.rs b/crates/ui-egui/src/tests/recolor.rs index 986dbb6290..d55b9f1882 100644 --- a/crates/ui-egui/src/tests/recolor.rs +++ b/crates/ui-egui/src/tests/recolor.rs @@ -104,6 +104,7 @@ fn presets_open_colour_jobs_and_libraries_and_both_tabs_draw() { entries.iter().filter(|e| e.path.last().is_some_and(|p| p == "Recolor with Preset")).map(|e| (e.label.as_str(), &e.params)).collect(); assert_eq!(presets.iter().map(|p| p.0).collect::>(), ["1 Color Job…", "2 Color Job…", "3 Color Job…", "Color Library…"]); app.run("ui.recolorDialog", presets[1].1.clone()).unwrap(); + dialogs::confirm(&mut app).unwrap(); dialog_frame(&mut app, &ctx); assert_eq!((field(&app, "colors"), field(&app, "method")), (json!(2), json!("scaleTints"))); assert_eq!(field(&app, "rows").as_array().unwrap().len(), 2); @@ -111,6 +112,8 @@ fn presets_open_colour_jobs_and_libraries_and_both_tabs_draw() { dialog_frame(&mut app, &ctx); dialogs::cancel(&mut app); app.run("ui.recolorDialog", presets[3].1.clone()).unwrap(); + assert_eq!(field(&app, "limitTo"), "web-safe-216", "Color Library asks with the first library chosen"); + dialogs::confirm(&mut app).unwrap(); assert_eq!(field(&app, "limitTo"), "web-safe-216", "Color Library starts on the first library"); dialog_frame(&mut app, &ctx); let web = |k: &Value| vectorcraft_engine::cmd::color_value(k).unwrap().to_rgb().iter().all(|v| ((v * 5.0).round() - v * 5.0).abs() < 1e-3); @@ -1992,3 +1995,184 @@ fn the_color_picker_leaves_the_dialog_in_place() { } assert_eq!(h.state().ui.dialog.as_ref().map(|d| d.kind.as_str()), Some("recolor")); } + +fn dialog_kind(app: &VectorcraftApp) -> Option<&str> { + app.ui.dialog.as_ref().map(|d| d.kind.as_str()) +} + +/// Edit › Edit Colors › Recolor with Preset asks whether to limit the colors to a swatch library +/// before Recolor Artwork opens: Cancel opens nothing, and OK opens Recolor Artwork with the +/// preset's colors and the library chosen. +#[test] +fn recolor_with_preset_asks_for_a_library_first() { + let mut app = app(); + let ctx = context(); + assert!(app.run("ui.recolorDialog", json!({"colors": 1, "preset": true})).is_err(), "nothing selected"); + assert_eq!(dialog_kind(&app), None); + art(&mut app, &["#333333", "#999999"]); + assert!(app.run("ui.recolorDialog", json!({"colors": 1, "preset": 1})).is_err(), "`preset` is true or false"); + assert!(app.run("ui.recolorDialog", json!({"colors": 0, "preset": true})).is_err(), "a preset has at least one color"); + assert_eq!(dialog_kind(&app), None); + let entries = crate::menus::menu_entries(&app); + let presets: Vec = + entries.iter().filter(|e| e.path.last().is_some_and(|p| p == "Recolor with Preset")).map(|e| e.params.clone()).collect(); + assert_eq!(presets.len(), 4); + for p in &presets { + app.run("ui.recolorDialog", p.clone()).unwrap(); + assert_eq!(dialog_kind(&app), Some(dialogs::recolor_preset::KIND), "{p}"); + dialog_frame(&mut app, &ctx); + dialogs::cancel(&mut app); + assert_eq!(dialog_kind(&app), None, "Cancel opens nothing: {p}"); + } + // A preset opened over Recolor Artwork's preview rolls the preview back. + let start = colors(&mut app); + app.run("ui.recolorDialog", json!({})).unwrap(); + set(&mut app, "colors", json!(1)); + set(&mut app, "method", json!("exact")); + dialog_frame(&mut app, &ctx); + assert_eq!(colors(&mut app), 1, "previewed"); + app.run("ui.recolorDialog", presets[0].clone()).unwrap(); + assert_eq!(dialog_kind(&app), Some(dialogs::recolor_preset::KIND)); + assert_eq!(colors(&mut app), start, "the preview is rolled back"); + assert_eq!(field(&app, "limitTo"), json!(""), "a color job starts on None"); + set(&mut app, "colors", json!("two")); + assert!(dialogs::confirm(&mut app).is_err(), "the count is checked again on OK"); + assert_eq!(dialog_kind(&app), Some(dialogs::recolor_preset::KIND), "the dialog stays"); + set(&mut app, "colors", json!(1)); + set(&mut app, "limitTo", json!("document")); + dialogs::confirm(&mut app).unwrap(); + assert_eq!(dialog_kind(&app), Some(dialogs::recolor::KIND)); + assert_eq!((field(&app, "colors"), field(&app, "method"), field(&app, "limitTo")), (json!(1), json!("scaleTints"), json!("document"))); + // Recolor Artwork opened over its own preview rolls that preview back too. + set(&mut app, "method", json!("exact")); + set(&mut app, "limitTo", json!("")); + dialog_frame(&mut app, &ctx); + assert_eq!(colors(&mut app), 1, "previewed"); + app.run("ui.recolorDialog", json!({})).unwrap(); + assert_eq!(colors(&mut app), start, "the preview is rolled back"); + dialogs::cancel(&mut app); +} + +/// Every paint under `v`, in order: its color, the swatch it is linked to and its tint. +fn paints_in(v: &Value, out: &mut Vec<(Color, Option, f64)>) { + match v { + Value::Object(m) => { + if let Some(c) = m.get("color").and_then(|c| serde_json::from_value::(c.clone()).ok()) { + out.push((c, m.get("swatch").and_then(Value::as_str).map(String::from), m.get("tint").and_then(Value::as_f64).unwrap_or(1.0))); + } + m.values().for_each(|x| paints_in(x, out)); + } + Value::Array(a) => a.iter().for_each(|x| paints_in(x, out)), + _ => {} + } +} + +/// Every number under an `opacity` key under `v`, in order. +fn opacities_in(v: &Value, out: &mut Vec) { + match v { + Value::Object(m) => { + out.extend(m.get("opacity").and_then(Value::as_f64)); + m.values().for_each(|x| opacities_in(x, out)); + } + Value::Array(a) => a.iter().for_each(|x| opacities_in(x, out)), + _ => {} + } +} + +/// The art of every layer as saved. +fn art_json(app: &VectorcraftApp) -> Value { + let d = &app.session.doc().unwrap().doc; + Value::Array(d.layers.iter().filter_map(|l| l.children()).map(|c| serde_json::to_value(c).unwrap()).collect()) +} + +fn art_paints(app: &VectorcraftApp) -> Vec<(Color, Option, f64)> { + let mut out = vec![]; + paints_in(&art_json(app), &mut out); + out +} + +/// A gray other than black or white, with its lightness. +fn gray(c: &Color) -> Option { + let [r, g, b] = c.to_rgb(); + ((r - g).abs() < 1e-3 && (g - b).abs() < 1e-3 && r > 0.01 && r < 0.99).then_some(r) +} + +/// Gray art placed from an SVG file (fills, a stroke, a group at 50% opacity, `fill-opacity`, a +/// compound path, a gradient's stops and type) with a 1 Color Job of Recolor with Preset limited +/// to the document's swatches and a spot or global ink picked for its row becomes tints of that +/// ink linked to its swatch, darker grays at higher tints, with its opacities kept; editing the +/// swatch then recolors the art at the same tints. A process swatch gives tints of its color with +/// no link. +#[test] +fn a_one_color_job_limited_to_document_swatches_links_gray_art_to_the_ink() { + let svg = r##"Ink"##; + let path = std::env::temp_dir().join(format!("vectorcraft-recolor-preset-{}.svg", std::process::id())); + std::fs::write(&path, svg).unwrap(); + for (kind, options, linked) in [("spot", json!({"spot": true}), true), ("global", json!({"global": true}), true), ("process", json!({}), false)] { + let mut app = app(); + let ctx = context(); + let mut swatch = json!({"name": "Ink", "color": "cmyk 0 100 0 0"}); + swatch.as_object_mut().unwrap().extend(options.as_object().unwrap().clone()); + app.run("swatch.new", swatch).unwrap(); + app.run("file.place", json!({"path": path.to_string_lossy(), "at": [120, 50]})).unwrap(); + app.run("select.all", json!({})).unwrap(); + let before = art_paints(&app); + let grays: Vec = (0..before.len()).filter(|&i| gray(&before[i].0).is_some()).collect(); + assert!(grays.len() >= 9, "{kind}: the fills, the stroke, the stops and the type are gray: {before:?}"); + let mut opacities = vec![]; + opacities_in(&art_json(&app), &mut opacities); + assert!(opacities.iter().any(|o| (o - 0.5).abs() < 1e-6), "the group's opacity came in: {opacities:?}"); + assert!(opacities.iter().any(|o| (o - 0.7).abs() < 1e-6), "the fill opacity came in: {opacities:?}"); + + let entries = crate::menus::menu_entries(&app); + let job = entries.iter().find(|e| e.label == "1 Color Job…").unwrap().params.clone(); + app.run("ui.recolorDialog", job).unwrap(); + set(&mut app, "limitTo", json!("document")); + dialogs::confirm(&mut app).unwrap(); + dialog_frame(&mut app, &ctx); + let ink = app.session.doc().unwrap().doc.swatch("Ink").unwrap().paint.color().unwrap(); + let mut rows = field(&app, "rows").as_array().unwrap().clone(); + let row = rows.iter().position(|r| !r["exclude"].as_bool().unwrap_or(false)).unwrap(); + assert!(rows.iter().enumerate().all(|(i, r)| i == row || r["exclude"].as_bool().unwrap_or(false)), "one row: {rows:?}"); + rows[row]["to"] = json!(ColorKey::of(&ink).to_string()); + set(&mut app, "rows", Value::Array(rows)); + dialog_frame(&mut app, &ctx); + dialogs::confirm(&mut app).unwrap(); + assert_eq!(dialog_kind(&app), None); + + let after = art_paints(&app); + assert_eq!(after.len(), before.len(), "{kind}: the art has the same paints"); + let mut kept = vec![]; + opacities_in(&art_json(&app), &mut kept); + assert_eq!(kept, opacities, "{kind}: the opacities are kept"); + for &i in &grays { + let (c, link, tint) = &after[i]; + assert!(gray(c).is_none(), "{kind}: paint {i} is no longer gray: {c:?}"); + assert_eq!(link.is_some(), linked, "{kind}: paint {i} linked: {link:?}"); + if linked { + assert_eq!(link.as_deref(), Some("Ink")); + assert!(*tint > 0.0 && *tint <= 1.0, "{kind}: paint {i} at a tint: {tint}"); + } + } + for (i, c) in before.iter().enumerate().filter(|(i, _)| !grays.contains(i)) { + assert_eq!(after[i].0, c.0, "{kind}: black and white are kept"); + } + if linked { + for &a in &grays { + for &b in &grays { + if gray(&before[a].0) < gray(&before[b].0) { + assert!(after[a].2 >= after[b].2, "{kind}: a darker gray takes more ink: {:?} {:?}", after[a], after[b]); + } + } + } + app.run("swatch.edit", json!({"name": "Ink", "color": "cmyk 100 0 0 0"})).unwrap(); + let edited = art_paints(&app); + for &i in &grays { + assert_eq!(edited[i].1.as_deref(), Some("Ink"), "{kind}: paint {i} stays linked"); + assert!((edited[i].2 - after[i].2).abs() < 1e-6, "{kind}: paint {i} keeps its tint"); + assert_ne!(edited[i].0, after[i].0, "{kind}: paint {i} takes the edited ink"); + } + } + } + let _ = std::fs::remove_file(&path); +} diff --git a/docs/control-protocol.md b/docs/control-protocol.md index dafab93a58..2f19b5fd37 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -287,9 +287,12 @@ canvas while open; `ui.dialog.confirm` keeps the result as one undo step (`edit. `edit.colors.saturate`) and `ui.dialog.cancel` rolls it back. Global mode answers with an error until tints of global and spot colours exist; the dialog then stays open. -Recolor Artwork: `ui.recolorDialog {colors?, library?, group?}` opens the `recolor` dialog on the selected art +Recolor Artwork: `ui.recolorDialog {colors?, library?, group?, preset?}` opens the `recolor` dialog on the selected art (`colors`: a count for an n-colour job, or colours to assign as the new colours; `library`: Limit to Library, a library -or `"document"`, `""` for the first library; `group`: a colour group, Edit or Apply Color Group). Fields: `rows` (`[{from: [keys], to: key, exclude?, tint?, model?}]` +or `"document"`, `""` for the first library; `group`: a colour group, Edit or Apply Color Group). With `preset: true` +(the Edit › Edit Colors › Recolor with Preset items) it first opens the `recolorPreset` dialog, which asks whether to +limit the colors to a swatch library: its field `limitTo` (a library id, `"document"`, or `""` for None) starts on +`library`, and its OK opens the `recolor` dialog with `colors` and that library. Fields: `rows` (`[{from: [keys], to: key, exclude?, tint?, model?}]` as `recolor.reduce` returns them), `colors` (null for Auto), `method`, `preserveWhite`, `preserveBlack`, `preserveGrays`, `limitTo`, `groupName`, `tab` (`assign` or `edit`), `rule` (harmony id), `linked`, `preview`, `sliderMode` (the mode of the color sliders under the rows: `hsb`, `rgb`, `cmyk`, `lab`, or `tint` for a row whose new diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 3da663c191..bf1b6461a3 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -641,6 +641,7 @@ since 2026-10-01. - **Trim View hides guides and the grid (#8363):** while View › Trim View is on, the canvas and tiled panes draw no ruler guides, no guide paths and no grid, the guides are neither snapped to nor picked, and Show/Hide Guides and Show/Hide Grid are greyed out (menu bar, canvas context menu, Properties) and refuse to run; the stored choices come back when it is turned off, and the rulers stay ([trim view hides guides](https://community.adobe.com/t5/illustrator-discussions/trim-view-hides-guides/td-p/14066140), [guides greyed out](https://community.adobe.com/t5/illustrator-discussions/guides-greyed-out/m-p/11132728)). A drag or double-click on a ruler makes no guide while it is on (no preview, no undo step, a status message). `trim_view_hides_the_guides_and_the_grid`, `trim_view_deselects_selected_guide_paths`, `trim_view_makes_no_guide_from_the_rulers` in `crates/ui-egui/src/canvas/tests.rs`; `trim_view_greys_out_show_guides_and_show_grid` in `crates/ui-egui/src/menus/tests.rs`. - **Recolor picker follow-up (#8031/#4028):** native Lab numeric entry, document/loaded-library swatches in the Color Picker, and Assign-row Pick from Swatches / Limit to Library menus. #4090 provided the double-click picker and #5113 the Assign sliders. Regression tests `native_lab_entry_in_color_picker` and `row_context_menu_pick_from_swatches_and_limit_to_library` exercise the fields and menu callbacks rather than writing their result state. Area score and hours unchanged. +- **Recolor with Preset asks for a library first:** Edit › Edit Colors › Recolor with Preset (1, 2 and 3 Color Job, Color Library) opens a Recolor with Preset dialog whose Limit to Library menu (None, Document Swatches or a library) is applied when Recolor Artwork opens (, "Quickly reduce colors using a preset"). A 1 Color Job limited to the document's swatches with a spot or global ink picked turns gray art into tints of that ink linked to its swatch, so editing the swatch recolors the art. Tests `recolor_with_preset_asks_for_a_library_first` and `a_one_color_job_limited_to_document_swatches_links_gray_art_to_the_ink`. Area score and hours unchanged. - **Quick Pen tool (#2660, in part):** a tool in the Pen tool's group (Alt+P, Option+P on macOS) draws straight lines, continuous arcs and sharp-corner arcs, one undo step per piece; Alt pressed and let go on its own switches the action, C flips the last sharp-corner arc, `[` and `]` change the arc size by 15°, a click on the first point closes the path, a click on an open end continues it, and Escape or Enter ends it (`path.quickPen`), as [Draw with the Quick Pen tool](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html) and [Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html) describe. The 180° default arc, its 15° steps, the side an arc bulges to, a dragged piece ending where the press is let go, and C, `[` and `]` changing the arc being dragged are VectorCraft's own rules. Tests: tools `quickpen::tests`, engine `tests::quickpen`, ui-egui `shortcuts::alt_tap::tests`, `alt_p_chooses_the_quick_pen_and_an_alt_tap_switches_its_action` and `brackets_size_the_quick_pen_arc_being_dragged`. Score and hours unchanged. - **Quick Pen protractor:** while an arc is drawn, by a drag or as the piece the next click adds, the Quick Pen tool shows a protractor around the arc's center: a tick every 15° from the arc's start, a longer one every 90°, and one at its end; the next click's piece shows it only with Enable Rubber Band for the Pen tool on. With Smart Guides on, the end of a continuous arc snaps onto the nearest tick within the snapping tolerance of the pointer when no other Smart Guide snaps the point and neither Snap to Grid nor Snap to Pixel snaps drawn points; Shift does not change it. A continuous arc that starts a path sweeps the arc size and does not snap to a tick, Alt tapped during a press moves the piece's end onto or off the tick for the new action, and a hover hides its preview after a snap setting changes until the pointer moves. The protractor, its 15° step and the tick snapping are VectorCraft's own behavior. Tests: tools `the_arc_circle_is_the_circle_the_arc_is_drawn_on`, `a_continuous_arc_end_goes_to_the_nearest_tick`, `a_tick_past_the_coordinate_limit_is_not_used`, `a_continuous_arc_without_a_direction_has_no_tick`, `the_protractor_ticks_lie_across_the_arc`; engine `a_continuous_arc_end_snaps_to_the_protractor`, `a_click_puts_a_continuous_arc_end_on_a_tick`, `an_alt_tap_during_a_press_moves_the_end_for_the_new_action`, `a_click_on_a_tick_leaves_no_preview_back_to_the_pointer`, `a_hover_snaps_to_a_tick_only_for_a_continuous_arc`, `a_hover_shows_nothing_after_smart_guides_change`, `a_click_that_adds_nothing_keeps_a_stale_hover_hidden`, `a_hover_is_hovered_again_when_the_art_changes`, `an_arc_drag_shows_the_protractor`, `a_hovered_arc_shows_the_protractor_with_the_rubber_band`. New tests of existing Quick Pen behavior: `a_point_snaps_to_a_smart_guide`, `hovering_shows_the_distance_label`. Score and hours unchanged. From da5344af2c5559ce6499e1d3163f3034ac9ba10c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 11:14:02 -0800 Subject: [PATCH 2/6] Recolor with Preset: test that grays of different lightness get different tints The 1 Color Job test now requires a strictly higher tint on the darker of two grays for a linked ink, and different colors for a process swatch, so a flat tint fails it. docs/ui-parity.md gets a Recolor with Preset item and the M3 row in docs/roadmap.md names the preset flow. --- crates/ui-egui/src/tests/recolor.rs | 14 +++++++++----- docs/roadmap.md | 2 +- docs/ui-parity.md | 2 ++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/tests/recolor.rs b/crates/ui-egui/src/tests/recolor.rs index d55b9f1882..9a96a274c3 100644 --- a/crates/ui-egui/src/tests/recolor.rs +++ b/crates/ui-egui/src/tests/recolor.rs @@ -2157,14 +2157,18 @@ fn a_one_color_job_limited_to_document_swatches_links_gray_art_to_the_ink() { for (i, c) in before.iter().enumerate().filter(|(i, _)| !grays.contains(i)) { assert_eq!(after[i].0, c.0, "{kind}: black and white are kept"); } - if linked { - for &a in &grays { - for &b in &grays { - if gray(&before[a].0) < gray(&before[b].0) { - assert!(after[a].2 >= after[b].2, "{kind}: a darker gray takes more ink: {:?} {:?}", after[a], after[b]); + for &a in &grays { + for &b in &grays { + if gray(&before[a].0) < gray(&before[b].0) { + if linked { + assert!(after[a].2 > after[b].2, "{kind}: a darker gray takes more ink: {:?} {:?}", after[a], after[b]); + } else { + assert_ne!(after[a].0, after[b].0, "{kind}: grays of different lightness get different colors: {a} {b}"); } } } + } + if linked { app.run("swatch.edit", json!({"name": "Ink", "color": "cmyk 100 0 0 0"})).unwrap(); let edited = art_paints(&app); for &i in &grays { diff --git a/docs/roadmap.md b/docs/roadmap.md index 27c4f78e25..9f90f7fcd2 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -184,7 +184,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule | M0 | Skeleton + vertical slice | ✅ done | — | | M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (a targeted Layers item with an appearance of its own shows its inner ring around a smaller appearance dot (#8711); path and compound-path interior selection follows enabled fill rows (#6625); a marquee leaves locked or hidden guide paths out inside groups, as clicks do (#8538); hidden-fill and no-fill stroke cap/join CPU regressions passed; document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 | | M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside fixed and varied tip sweeps and Alt-drag marquees on fill-only open paths and keeps their compound holes; clipping masks retain surviving contours or empty geometry in the same node; ordinary Group/Layer paints and evaluated gradient placements are preserved when the stored paint reproduces their appearance; hidden Rasterize and Along/Across stroke rows do not block visible gradients; replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot be reproduced keep their existing fitting; stroked open paths retain main behavior (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123); Scissors hover and cuts use the Pen's path/align/intersect/anchor snaps, with Alt Add Anchor and cut endpoint selection retained (#6470); Scissors previews the current anchor or curve cut point (#8655) | 12–18 | -| M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper copies transformed character dimensions (#6404) and styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel (its spectrum grows with a resized panel, #8005), Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416; native Lab entry and swatch libraries in the picker, Assign-row menus, #8031/#4028); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Graphic Styles list fills a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); | 4–8 | +| M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper copies transformed character dimensions (#6404) and styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel (its spectrum grows with a resized panel, #8005), Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416; native Lab entry and swatch libraries in the picker, Assign-row menus, #8031/#4028; Recolor with Preset asks whether to limit the colors to a swatch library first); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Graphic Styles list fills a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); | 4–8 | | M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths (#8128; estimates unchanged); Production Preflight checks fonts, overflow, links and image resolution with clickable findings and automatic rechecking (VectorCraft addition; estimates unchanged); PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300; estimates unchanged); PDF import: type filled and stroked by one text-showing operator comes in as one filled and stroked type object (#8015; not for type filled and stroked at less than full opacity, which still comes in as a filled object and a stroked one, as the file composites them; estimates unchanged); PDF import: type filled and stroked by a `TJ` whose kerning starts a new line part way through comes in filled and stroked, a type object for each part, also where it draws a glyph again where it drew one, in an `ActualText` span too, where it stays one replacement type object on the first glyph's line and in its style; a `TJ` over more than 65 lines (the 64 its fill pass finished, kept back, and the open one) stays a filled object and a stroked one for each part (#8543; estimates unchanged); PDF import: type filled and stroked after a page of type filled only (more than 64 lines) comes in as one filled and stroked type object again, with or without a path between, and a `TJ` over more lines than are kept with a glyph kept as an outline still stays a filled object and a stroked one for each part (#8549 follow-up; estimates unchanged); PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; estimates unchanged); Rename artboards in Export for Screens (#7275); Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) | | M5 | Performance | 🟡 background render + caches + MT done; text thread overlays index repeated selection lookups, keeping the first lookup and singleton selections direct (#6543); `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; in the web build an edit while the view of a heavy document moves draws only the part it changed into the last frame (#8688); dirty-region rendering, GPU backend spike pending | 15–25 | | M6 | Path operations (Pathfinder, Shape Builder, offset…) | ✅ mostly done (live compound shapes: Make, Alt-click a Shape Mode, member modes, Release, Expand (#4522); single-result Pathfinder names and SVG IDs retained (#1293); Divide open-cutting-path geometry, appearance and history verified (#1307; existing segment cap remains); Simplify preview/counts and rewritten-path component selection verified (#1272; the slider opens at the Auto-Simplify level; a Direct Selection part of a path simplifies on its own); Compound appearance and member fill-rule edits verified (#1197); Boolean precision on almost-horizontal edges fixed and the property tests made deterministic; Shape Builder gap detection, large-offset bug open); Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog | 3–6 | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index e9fd857a9d..c653497fd9 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -580,6 +580,8 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po - [x] Recolor Artwork › Assign: double-click a row's new color to pick it in the Color Picker, in the model it was picked in, with native Lab entry, swatch libraries access in the picker, and row context menu options (Pick from Swatches, Limit to Library) (#8031, follow-up to #4090/#5113 for #4028). Evidence: `native_lab_entry_in_color_picker` and `row_context_menu_pick_from_swatches_and_limit_to_library` exercise numeric entry and actual menu clicks. +- [x] Edit › Edit Colors › Recolor with Preset: the 1, 2 and 3 Color Job and Color Library presets first open a Recolor with Preset dialog whose Limit to Library menu (None, Document Swatches or a library) is applied when Recolor Artwork opens; Cancel opens nothing. A 1 Color Job limited to the document's swatches with a spot or global ink picked turns gray art into tints of that ink linked to its swatch. Evidence: `recolor_with_preset_asks_for_a_library_first` and `a_one_color_job_limited_to_document_swatches_links_gray_art_to_the_ink`. + - [x] Recolor Artwork › Color Theme Picker: with the button beside the tabs on, a click on the canvas takes the color palette of an object or image, a drag takes the palette of the art inside its marquee, and Shift adds more picks; the rows that aren't excluded take the palette as their new colors and the art previews them ([Recolor artwork](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/recolor-artwork.html)). The number and order of the picked colors are VectorCraft's own rule (`recolor.pickTheme`). Tests: `theme_picks_give_the_rows_the_palette_of_the_art_picked` and `the_theme_picker_takes_clicks_and_shift_drags_on_the_canvas` in `crates/ui-egui/src/dialogs/recolor.rs`, `theme_picker_*` in `crates/engine/src/tests/recolor.rs`. - [x] Recolor Artwork › Prominent Colors: with art, a bar under the Edit tab's wheel shows the new colors, each as wide as its share of the art; dragging the edge between two parts raises one color's weight and lowers the other's, and the art previews the result; the New Color Group menu has Save All Colors and Save Prominent Colors ([Recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/recolor-options-overview.html)). How a share is measured and how a weight moves colors between rows are VectorCraft's own rules (`recolor.weigh`). Tests: `weights_move_the_rows_colors_and_the_art_previews_them`, `dragging_a_prominent_edge_moves_colors_between_rows` and `save_all_and_prominent_colors_make_color_groups` in `crates/ui-egui/src/dialogs/recolor.rs`, `weigh_*` in `crates/engine/src/tests/recolor.rs`. From 23b6184c5b506323574a7348cf7b0bd3cf48cff1 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 11:31:42 -0800 Subject: [PATCH 3/6] Recolor with Preset: reject a color group ui.recolorDialog with preset: true and a group opened the preset dialog and dropped the group, so OK recolored the art without rewriting the group. That call is now an error. The params text and docs/control-protocol.md say so. --- crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/dialogs/recolor_preset.rs | 5 ++++- crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/tests/recolor.rs | 1 + docs/control-protocol.md | 3 ++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 18951b9c90..f2c66fd0e7 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -995,7 +995,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.recolorDialog", "Recolor Artwork…", "", - "{colors?: n (an n-colour job: n rows, Scale Tints) | [colour] (new colours to assign, in order; with no art selected and no group they are the rows, and OK saves them as a new colour group, field `groupName`: the Color Guide's Edit or Apply Colors), library?: id or name; or \"document\" (Limit to Library; \"\" the first library), group?: colour group (Edit or Apply Color Group: OK rewrites the group with the new colours and recolours the selected art, if any), preset?: bool (Recolor with Preset: first open the `recolorPreset` dialog, whose Limit to Library field `limitTo` starts on `library`; its OK opens Recolor Artwork with `colors` and that library)} open Recolor Artwork (dialog `recolor`; engine: recolor.reduce / recolor.apply)", + "{colors?: n (an n-colour job: n rows, Scale Tints) | [colour] (new colours to assign, in order; with no art selected and no group they are the rows, and OK saves them as a new colour group, field `groupName`: the Color Guide's Edit or Apply Colors), library?: id or name; or \"document\" (Limit to Library; \"\" the first library), group?: colour group (Edit or Apply Color Group: OK rewrites the group with the new colours and recolours the selected art, if any), preset?: bool (Recolor with Preset: first open the `recolorPreset` dialog, whose Limit to Library field `limitTo` starts on `library`; its OK opens Recolor Artwork with `colors` and that library; an error with `group`)} open Recolor Artwork (dialog `recolor`; engine: recolor.reduce / recolor.apply)", ), ( "ui.recolorUndo", diff --git a/crates/ui-egui/src/dialogs/recolor_preset.rs b/crates/ui-egui/src/dialogs/recolor_preset.rs index a9063c8945..9ebde00787 100644 --- a/crates/ui-egui/src/dialogs/recolor_preset.rs +++ b/crates/ui-egui/src/dialogs/recolor_preset.rs @@ -1,6 +1,6 @@ //! Edit → Edit Colors → Recolor with Preset: before Recolor Artwork opens on a preset (an n-color //! job or Color Library), this dialog asks whether to limit the new colors to a swatch library -//! (`ui.recolorDialog {preset: true, colors?, library?}`). OK opens Recolor Artwork with the +//! (`ui.recolorDialog {preset: true, colors?, library?}`, without `group`). OK opens Recolor Artwork with the //! preset's colors and the library chosen (None: no limit); Cancel opens nothing. //! //! Fields: `colors` (the preset's count, null for Color Library) and `limitTo` (a library id, @@ -27,6 +27,9 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { if st.selection.is_empty() { return Err("select artwork to recolor".into()); } + if p.get("group").is_some_and(|g| !g.is_null()) { + return Err("`group` does not apply to a preset".into()); + } let colors = count(p.get("colors"))?; let limit = library_param(app, p)?; // A dialog this one replaces ends as Cancel ends it, its preview rolled back. diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 27bcf98155..10b0982582 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -996,7 +996,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.recolorDialog", "Recolor Artwork…", "", - "{colors?: n (an n-colour job: n rows, Scale Tints) | [colour] (new colours to assign, in order; with no art selected and no group they are the rows, and OK saves them as a new colour group, field `groupName`: the Color Guide's Edit or Apply Colors), library?: id or name; or \"document\" (Limit to Library; \"\" the first library), group?: colour group (Edit or Apply Color Group: OK rewrites the group with the new colours and recolours the selected art, if any), preset?: bool (Recolor with Preset: first open the `recolorPreset` dialog, whose Limit to Library field `limitTo` starts on `library`; its OK opens Recolor Artwork with `colors` and that library)} open Recolor Artwork (dialog `recolor`; engine: recolor.reduce / recolor.apply)", + "{colors?: n (an n-colour job: n rows, Scale Tints) | [colour] (new colours to assign, in order; with no art selected and no group they are the rows, and OK saves them as a new colour group, field `groupName`: the Color Guide's Edit or Apply Colors), library?: id or name; or \"document\" (Limit to Library; \"\" the first library), group?: colour group (Edit or Apply Color Group: OK rewrites the group with the new colours and recolours the selected art, if any), preset?: bool (Recolor with Preset: first open the `recolorPreset` dialog, whose Limit to Library field `limitTo` starts on `library`; its OK opens Recolor Artwork with `colors` and that library; an error with `group`)} open Recolor Artwork (dialog `recolor`; engine: recolor.reduce / recolor.apply)", ), ( "ui.recolorUndo", diff --git a/crates/ui-egui/src/tests/recolor.rs b/crates/ui-egui/src/tests/recolor.rs index 9a96a274c3..455f98055a 100644 --- a/crates/ui-egui/src/tests/recolor.rs +++ b/crates/ui-egui/src/tests/recolor.rs @@ -2012,6 +2012,7 @@ fn recolor_with_preset_asks_for_a_library_first() { art(&mut app, &["#333333", "#999999"]); assert!(app.run("ui.recolorDialog", json!({"colors": 1, "preset": 1})).is_err(), "`preset` is true or false"); assert!(app.run("ui.recolorDialog", json!({"colors": 0, "preset": true})).is_err(), "a preset has at least one color"); + assert!(app.run("ui.recolorDialog", json!({"colors": 1, "preset": true, "group": "Grays"})).is_err(), "a preset takes no group"); assert_eq!(dialog_kind(&app), None); let entries = crate::menus::menu_entries(&app); let presets: Vec = diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 2f19b5fd37..dfe005ba1c 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -292,7 +292,8 @@ Recolor Artwork: `ui.recolorDialog {colors?, library?, group?, preset?}` opens t or `"document"`, `""` for the first library; `group`: a colour group, Edit or Apply Color Group). With `preset: true` (the Edit › Edit Colors › Recolor with Preset items) it first opens the `recolorPreset` dialog, which asks whether to limit the colors to a swatch library: its field `limitTo` (a library id, `"document"`, or `""` for None) starts on -`library`, and its OK opens the `recolor` dialog with `colors` and that library. Fields: `rows` (`[{from: [keys], to: key, exclude?, tint?, model?}]` +`library`, and its OK opens the `recolor` dialog with `colors` and that library; `preset: true` with `group` is an +error. Fields: `rows` (`[{from: [keys], to: key, exclude?, tint?, model?}]` as `recolor.reduce` returns them), `colors` (null for Auto), `method`, `preserveWhite`, `preserveBlack`, `preserveGrays`, `limitTo`, `groupName`, `tab` (`assign` or `edit`), `rule` (harmony id), `linked`, `preview`, `sliderMode` (the mode of the color sliders under the rows: `hsb`, `rgb`, `cmyk`, `lab`, or `tint` for a row whose new From ec3fe96195893bf7f75d8b5594274f45b31fc690 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 11:46:52 -0800 Subject: [PATCH 4/6] Recolor Artwork: roll back the replaced preview before reading the group Opening Recolor Artwork on a color group over its own preview of that group read the group's colors before the preview was rolled back, so the new dialog started on the previewed colors and OK could apply them again. The replaced dialog now ends first, after the parameters are checked, and the group is read from the restored document. --- crates/ui-egui/src/dialogs/recolor.rs | 27 +++++++++++++++++---------- crates/ui-egui/src/tests/recolor.rs | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/crates/ui-egui/src/dialogs/recolor.rs b/crates/ui-egui/src/dialogs/recolor.rs index 2901c69bd9..46c02bbf05 100644 --- a/crates/ui-egui/src/dialogs/recolor.rs +++ b/crates/ui-egui/src/dialogs/recolor.rs @@ -200,6 +200,23 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { let st = app.session.active().ok_or("no document open")?; let art = !st.selection.is_empty(); let group = p.get("group").and_then(Value::as_str); + if let Some(g) = group + && !st.doc.swatch_groups.iter().any(|x| x.name == g) + { + return Err(format!("no colour group `{g}`")); + } + // Colours alone (no art, no group) become a new colour group. + let new_group = !art && group.is_none(); + if new_group && !matches!(p.get("colors"), Some(Value::Array(cs)) if cs.iter().any(|c| color_value(c).is_some())) { + return Err("select artwork (or a colour group) to recolor".into()); + } + let limit = library_param(app, p)?; + // A dialog this one replaces ends as Cancel ends it, its preview rolled back, before the + // group's colours are read. + if app.ui.dialog.is_some() { + super::cancel(app); + } + let st = app.session.active().ok_or("no document open")?; let group_colors: Option> = match group { Some(g) => { let g = st.doc.swatch_groups.iter().find(|x| x.name == g).ok_or_else(|| format!("no colour group `{g}`"))?; @@ -212,17 +229,11 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { (None, Some(Value::Array(cs))) => cs.iter().filter_map(color_value).map(|c| key(&c)).collect(), _ => vec![], }; - // Colours alone (no art, no group) become a new colour group. - let new_group = !art && group.is_none(); - if new_group && assign.is_empty() { - return Err("select artwork (or a colour group) to recolor".into()); - } let count = match p.get("colors").and_then(Value::as_u64) { Some(n) => json!(n.max(1)), None if !assign.is_empty() => json!(assign.len()), None => Value::Null, }; - let limit = library_param(app, p)?; // Without art the rows are the group's colours, as they are. let mut start: Vec = if art { vec![] } else { assign.iter().map(|k| json!({"from": [k], "to": k})).collect() }; number_slots(&mut start); @@ -242,10 +253,6 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { snap(app, &d, &mut rs); d.fields.insert("rows".into(), Value::Array(rs)); // Undo Changes has nothing to undo on a new opening. - // A dialog this one replaces ends as Cancel ends it, its preview rolled back. - if app.ui.dialog.is_some() { - super::cancel(app); - } app.ui.recolor_history = History { opened: Some(snapshot(&d)), ..History::default() }; app.ui.dialog = Some(d); Ok(Value::Null) diff --git a/crates/ui-egui/src/tests/recolor.rs b/crates/ui-egui/src/tests/recolor.rs index 455f98055a..5f2a79b9e5 100644 --- a/crates/ui-egui/src/tests/recolor.rs +++ b/crates/ui-egui/src/tests/recolor.rs @@ -2054,6 +2054,27 @@ fn recolor_with_preset_asks_for_a_library_first() { dialogs::cancel(&mut app); } +/// Recolor Artwork opened on a colour group over its own preview of that group starts on the +/// group's colours as the rolled-back preview leaves them. +#[test] +fn reopening_a_group_over_its_preview_starts_on_the_groups_colours() { + let mut app = app(); + let ctx = context(); + art(&mut app, &["#ff0000", "#0000ff"]); + let before = group_keys(&app, "Brights"); + app.run("ui.recolorDialog", json!({"group": "Brights"})).unwrap(); + dialog_frame(&mut app, &ctx); + let mut rows = field(&app, "rows"); + rows[1]["to"] = json!("rgb 1 2 3"); + set(&mut app, "rows", rows); + dialog_frame(&mut app, &ctx); + assert_ne!(group_keys(&app, "Brights"), before, "the preview changes the group"); + app.run("ui.recolorDialog", json!({"group": "Brights"})).unwrap(); + assert_eq!(group_keys(&app, "Brights"), before, "the preview is rolled back"); + assert_eq!(field(&app, "__assign"), json!(before), "the new dialog starts on the group's colours"); + dialogs::cancel(&mut app); +} + /// Every paint under `v`, in order: its color, the swatch it is linked to and its tint. fn paints_in(v: &Value, out: &mut Vec<(Color, Option, f64)>) { match v { From b7c98147e905f237df0dc7598836df047e634991 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 15:51:43 -0800 Subject: [PATCH 5/6] Recolor Artwork: find a renamed group's name over its preview Opening Recolor Artwork on a color group while the open dialog previewed a rename of that group failed with "no colour group", because the name was checked against the previewed document before Cancel restored it. The name is now checked against the document without the replaced dialog's preview. An unknown group still fails and leaves the open dialog as it is. --- crates/ui-egui/src/dialogs/recolor.rs | 8 +++++++- crates/ui-egui/src/tests/recolor.rs | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/dialogs/recolor.rs b/crates/ui-egui/src/dialogs/recolor.rs index 46c02bbf05..19657a52ca 100644 --- a/crates/ui-egui/src/dialogs/recolor.rs +++ b/crates/ui-egui/src/dialogs/recolor.rs @@ -200,8 +200,14 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { let st = app.session.active().ok_or("no document open")?; let art = !st.selection.is_empty(); let group = p.get("group").and_then(Value::as_str); + // The group is looked for in the document without the preview of the dialog this one replaces + // (which can rename the group), as that dialog's Cancel below leaves it. + let unpreviewed = match &st.interaction { + Some(it) if app.ui.dialog.is_some() => &it.doc, + _ => &st.doc, + }; if let Some(g) = group - && !st.doc.swatch_groups.iter().any(|x| x.name == g) + && !unpreviewed.swatch_groups.iter().any(|x| x.name == g) { return Err(format!("no colour group `{g}`")); } diff --git a/crates/ui-egui/src/tests/recolor.rs b/crates/ui-egui/src/tests/recolor.rs index 5f2a79b9e5..766f47b047 100644 --- a/crates/ui-egui/src/tests/recolor.rs +++ b/crates/ui-egui/src/tests/recolor.rs @@ -2075,6 +2075,28 @@ fn reopening_a_group_over_its_preview_starts_on_the_groups_colours() { dialogs::cancel(&mut app); } +/// Recolor Artwork opened on a colour group over a preview that renames it finds the group by its +/// name without the preview; an unknown group leaves the open dialog as it is. +#[test] +fn reopening_a_group_over_a_preview_that_renames_it_finds_the_group() { + let mut app = app(); + let ctx = context(); + art(&mut app, &["#ff0000", "#0000ff"]); + let before = group_keys(&app, "Brights"); + app.run("ui.recolorDialog", json!({"group": "Brights"})).unwrap(); + dialog_frame(&mut app, &ctx); + set(&mut app, "groupName", json!("Renamed")); + dialog_frame(&mut app, &ctx); + let named = |app: &VectorcraftApp, n: &str| app.session.doc().unwrap().doc.swatch_groups.iter().any(|g| g.name == n); + assert!(named(&app, "Renamed") && !named(&app, "Brights"), "the preview renames the group"); + assert!(app.run("ui.recolorDialog", json!({"group": "Nope"})).is_err()); + assert_eq!(field(&app, "groupName"), json!("Renamed"), "an unknown group leaves the dialog open"); + app.run("ui.recolorDialog", json!({"group": "Brights"})).unwrap(); + assert!(named(&app, "Brights") && !named(&app, "Renamed"), "the preview is rolled back"); + assert_eq!(field(&app, "__assign"), json!(before), "the new dialog starts on the group's colours"); + dialogs::cancel(&mut app); +} + /// Every paint under `v`, in order: its color, the swatch it is linked to and its tint. fn paints_in(v: &Value, out: &mut Vec<(Color, Option, f64)>) { match v { From eaf1c48e5e9476146f3579a1367de0cf710e209b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 16:13:38 -0800 Subject: [PATCH 6/6] Recolor Artwork: reject a library or group that is not a string ui.recolorDialog, with or without a preset, treated a `library` or `group` of another type as omitted, so a preset opened with no limit and OK could recolor the art without the library that was asked for. Both are now an error that opens no dialog. Null still means none. --- crates/ui-egui/src/dialogs/recolor.rs | 18 ++++++++++++------ crates/ui-egui/src/tests/recolor.rs | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/dialogs/recolor.rs b/crates/ui-egui/src/dialogs/recolor.rs index 19657a52ca..682954ac7f 100644 --- a/crates/ui-egui/src/dialogs/recolor.rs +++ b/crates/ui-egui/src/dialogs/recolor.rs @@ -199,7 +199,11 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { } let st = app.session.active().ok_or("no document open")?; let art = !st.selection.is_empty(); - let group = p.get("group").and_then(Value::as_str); + let group = match p.get("group") { + None | Some(Value::Null) => None, + Some(Value::String(g)) => Some(g.as_str()), + Some(_) => return Err("`group` must be a colour group name".into()), + }; // The group is looked for in the document without the preview of the dialog this one replaces // (which can rename the group), as that dialog's Cancel below leaves it. let unpreviewed = match &st.interaction { @@ -283,12 +287,14 @@ pub(super) fn library_choices(app: &VectorcraftApp) -> (Vec, Vec (keys, shown) } -/// The `limitTo` key of `ui.recolorDialog`'s `library` (none without it, the first library for ""). +/// The `limitTo` key of `ui.recolorDialog`'s `library` (none without it or for null, the first +/// library for ""); a `library` that is not a string is an error. pub(super) fn library_param(app: &VectorcraftApp, p: &Value) -> Result { - match p.get("library").and_then(Value::as_str) { - Some("") => Ok(first_library(app).unwrap_or_default()), - Some(l) => limit_key(app, l), - None => Ok(String::new()), + match p.get("library") { + Some(Value::String(l)) if l.is_empty() => Ok(first_library(app).unwrap_or_default()), + Some(Value::String(l)) => limit_key(app, l), + None | Some(Value::Null) => Ok(String::new()), + Some(_) => Err("`library` must be a library id or name".into()), } } diff --git a/crates/ui-egui/src/tests/recolor.rs b/crates/ui-egui/src/tests/recolor.rs index 766f47b047..e618b4e830 100644 --- a/crates/ui-egui/src/tests/recolor.rs +++ b/crates/ui-egui/src/tests/recolor.rs @@ -2097,6 +2097,27 @@ fn reopening_a_group_over_a_preview_that_renames_it_finds_the_group() { dialogs::cancel(&mut app); } +/// A `library` or `group` that is not a string is an error, with or without a preset, and opens +/// no dialog. +#[test] +fn recolor_rejects_a_library_or_group_that_is_not_a_string() { + let mut app = app(); + art(&mut app, &["#ff0000", "#0000ff"]); + for p in [ + json!({"colors": 1, "library": 123}), + json!({"preset": true, "colors": 1, "library": 123}), + json!({"preset": true, "colors": 1, "library": true}), + json!({"group": 5}), + json!({"group": ["Brights"]}), + ] { + assert!(app.run("ui.recolorDialog", p.clone()).is_err(), "{p}"); + assert!(app.ui.dialog.is_none(), "{p} opens no dialog"); + } + app.run("ui.recolorDialog", json!({"colors": 1, "library": null, "group": null})).unwrap(); + assert_eq!(field(&app, "limitTo"), json!(""), "a null library is no limit"); + dialogs::cancel(&mut app); +} + /// Every paint under `v`, in order: its color, the swatch it is linked to and its tint. fn paints_in(v: &Value, out: &mut Vec<(Color, Option, f64)>) { match v {