Recolor Artwork: Undo Changes and Redo Changes step through the dialog's own color edits

Two buttons beside the Color Theme Picker go back and forward one color
edit made in the open dialog: the rows, Colors, Method, the Preserve
options, Limit to Library, the harmony rule, Global Adjust, the Color
Theme Picker's picks and the Prominent Colors weights. The art previews
each step. The dialog's history is separate from the document's: OK
still records one undo step and Cancel discards the edits with their
history. Each opening starts with nothing to undo, as the help page
describes (https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/recolor-options-overview.html).

VectorCraft's own rules: a change is one step once the pointer is
released, so a drag is one step; Reset is a step of its own; a new edit
after Undo Changes leaves nothing to redo; a button with no step to go
to is disabled; the dialog keeps at most 64 steps and 4 MiB of them.

ui.recolorUndo and ui.recolorRedo run the buttons and return
{changed, canUndo, canRedo}.
This commit is contained in:
dotCooCoo
2026-11-17 14:11:12 -08:00
parent ee60c51fd9
commit f5456410b2
38 changed files with 498 additions and 1 deletions
+12
View File
@@ -850,6 +850,18 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"",
"{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)",
),
(
"ui.recolorUndo",
"Undo Changes",
"",
"{} the open Recolor Artwork dialog goes back one of its own color edits (rows, Colors, Method, the Preserve options, Limit to Library, the harmony rule, Global Adjust, the Color Theme Picker's picks, the Prominent Colors weights): its fields and the preview return to their values before that edit; the document's undo history is unchanged, and OK still records one undo step → {changed, canUndo, canRedo}; an error when the dialog isn't open. Each opening starts with nothing to undo",
),
(
"ui.recolorRedo",
"Redo Changes",
"",
"{} the open Recolor Artwork dialog restores the color edit ui.recolorUndo went back from last; a new edit after ui.recolorUndo leaves nothing to redo → {changed, canUndo, canRedo}; an error when the dialog isn't open",
),
(
"ui.cropImage",
"Crop Image",
+4
View File
@@ -707,6 +707,10 @@ pub fn cancel(app: &mut VectorcraftApp) {
script_run::notice_cancel(app, &d);
}
missing_links::cancelled(app, &d);
// Cancel discards Recolor Artwork's own history of color edits with them.
if d.kind == recolor::KIND {
app.ui.recolor_history = Default::default();
}
// Find Font's next open starts with an empty replacement search.
if d.kind == "findFont"
&& let Some(ctx) = app.ui_ctx.clone()
+205 -1
View File
@@ -54,6 +54,11 @@
//! the most used color first and repeating when the rows outnumber them, and the art previews
//! them; OK keeps them as one undo step. A new count of Colors keeps the picks: the new rows take them again.
//!
//! Undo Changes and Redo Changes beside the Color Theme Picker (`ui.recolorUndo`, `ui.recolorRedo`)
//! step back and forward through the dialog's own color edits ([`History`]), not the document's
//! undo history; Cancel discards them and OK still records one undo step. Each opening starts
//! with nothing to undo.
//!
//! Fields (`ui.dialog.set`): `rows` ([{from: [keys], to: key, exclude?, tint?: percent of a spot
//! color, added?}]; a row with no current colors, `from: []`, recolors no art, and with `added: true`
//! (a color the Add Color tool added) adds its new color to the color group; `to: null`, no new color), `colors` (null: Auto, or a count), `method`, `preserveWhite`, `preserveBlack`,
@@ -188,6 +193,8 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result<Value, String> {
let mut rs = rows(&d);
snap(app, &d, &mut rs);
d.fields.insert("rows".into(), Value::Array(rs));
// Undo Changes has nothing to undo on a new opening.
app.ui.recolor_history = History { opened: Some(snapshot(&d)), ..History::default() };
app.ui.dialog = Some(d);
Ok(Value::Null)
}
@@ -735,11 +742,13 @@ fn find_params(d: &Dialog) -> Option<Value> {
}
fn body(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool {
seed(app, d);
sync(app, d);
sync_theme(app, d);
sync_weights(app, d);
let t = Tokens::get(ui.ctx());
let picking = d.bool(THEME_PICKER);
let mut stepped = None;
ui.horizontal(|ui| {
let tab = d.str("tab");
for (id, label) in [("assign", tl!("Assign")), ("edit", tl!("Edit"))] {
@@ -751,6 +760,12 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool {
if widgets::icon_button(ui, "pipette", tl!("Color Theme Picker"), picking, 24.0).clicked() {
d.fields.insert(THEME_PICKER.into(), json!(!picking));
}
let h = &app.ui.recolor_history;
for (back, icon, tip) in [(true, "undo-2", tl!("Undo Changes")), (false, "redo-2", tl!("Redo Changes"))] {
if widgets::icon_button_enabled(ui, icon, tip, false, h.can(d, back), 24.0).clicked() {
stepped = Some(back);
}
}
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
// The label is drawn after the menu (right-to-left), so it cannot name it by adjacency.
if let Some(i) = widgets::dropdown_named(ui, "recolor-preset", Some(tl!("Preset:")), PRESETS[preset_of(d)], &PRESETS, 130.0) {
@@ -759,6 +774,9 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool {
ui.label(egui::RichText::new(tl!("Preset:")).color(t.text_dim));
});
});
if let Some(back) = stepped {
app.ui.recolor_history.step(d, back);
}
widgets::divider(ui);
ui.add_space(4.0);
if d.bool(THEME_PICKER) {
@@ -793,6 +811,12 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool {
});
}
sync(app, d);
// New rows take the picks now, so that a new count of Colors is one step.
sync_theme(app, d);
// A change is a step once the pointer is up: a drag is one step from press to release.
if !ui.input(|i| i.pointer.any_down()) {
app.ui.recolor_history.note(d);
}
if d.bool("__art") {
match find_params(d) {
// Find shows the art so with Preview off too.
@@ -825,6 +849,145 @@ pub(super) fn with_new_color(app: &VectorcraftApp, mut d: Dialog, i: usize, c: C
d
}
/// The fields a step of Undo Changes and Redo Changes restores: what the art is recolored with.
const STEP_FIELDS: [&str; 11] =
["rows", "colors", "method", "preserveWhite", "preserveBlack", "preserveGrays", "limitTo", "rule", "globalAdjust", THEME_PICKS, WEIGHTS];
/// The fields that record which reduction, picks and weights the rows already took, restored with
/// [`STEP_FIELDS`] so that the restored rows are not reduced, picked or weighed again.
const STEP_MARKS: [&str; 4] = ["__reduced", THEME_DONE, WEIGHED, PRESERVED];
/// VectorCraft's own limits on the steps Undo Changes keeps: at most this many, and at most this
/// many bytes of them as JSON; the oldest go first.
const MAX_STEPS: usize = 64;
const MAX_STEP_BYTES: usize = 4 << 20;
type Snapshot = serde_json::Map<String, Value>;
/// The open dialog's own history of color edits: Undo Changes goes back one edit and Redo Changes
/// forward one, without touching the document's undo history. A change of [`STEP_FIELDS`] is one
/// step once the pointer is up, so a drag is one step; a new edit after Undo Changes ends what Redo
/// Changes could restore.
#[derive(Clone, Debug, Default)]
pub struct History {
/// The fields the dialog opened with, before it read the art, until its first frame or command.
opened: Option<Snapshot>,
/// The fields after the last step (none before the dialog's first frame).
base: Option<Snapshot>,
undo: Vec<Snapshot>,
redo: Vec<Snapshot>,
}
/// The fields of `d` a step restores ([`STEP_FIELDS`] and [`STEP_MARKS`]).
fn snapshot(d: &Dialog) -> Snapshot {
STEP_FIELDS.iter().chain(&STEP_MARKS).filter_map(|k| Some((k.to_string(), d.fields.get(*k)?.clone()))).collect()
}
/// Before the first step is recorded: when fields were set after the dialog opened (with
/// `ui.dialog.set`, before a frame drew it), the fields it opened with, as they read the art, are
/// the step Undo Changes goes back to.
fn seed(app: &mut VectorcraftApp, d: &Dialog) {
let Some(opened) = app.ui.recolor_history.opened.take() else { return };
if app.ui.recolor_history.base.is_some() || snapshot(d) == opened {
return;
}
let mut first = d.clone();
first.fields.remove(super::form::PREVIEWED);
for k in STEP_FIELDS.iter().chain(&STEP_MARKS) {
match opened.get(*k) {
Some(v) => first.fields.insert(k.to_string(), v.clone()),
None => first.fields.remove(*k),
};
}
sync(app, &mut first);
sync_theme(app, &mut first);
app.ui.recolor_history.base = Some(snapshot(&first));
}
impl History {
/// Whether the fields of `d` differ from those after the last step.
fn pending(&self, d: &Dialog) -> bool {
self.base.as_ref().is_some_and(|b| STEP_FIELDS.iter().any(|k| d.fields.get(*k) != b.get(*k)))
}
/// Record a change of `d`'s fields since the last step as a step.
fn note(&mut self, d: &Dialog) {
if self.base.is_some() && !self.pending(d) {
return;
}
if let Some(before) = self.base.replace(snapshot(d)) {
self.undo.push(before);
self.redo.clear();
self.trim();
}
}
/// Drop the oldest steps past [`MAX_STEPS`] and [`MAX_STEP_BYTES`] (all of them when the
/// current fields alone pass it).
fn trim(&mut self) {
let extra = self.undo.len().saturating_sub(MAX_STEPS);
self.undo.drain(..extra);
let size = |s: &Snapshot| serde_json::to_vec(s).map_or(0, |b| b.len());
let mut total: usize = self.base.iter().chain(&self.undo).map(size).sum();
let mut gone = 0;
while total > MAX_STEP_BYTES && gone < self.undo.len() {
total -= size(&self.undo[gone]);
gone += 1;
}
self.undo.drain(..gone);
}
fn can(&self, d: &Dialog, back: bool) -> bool {
if back { !self.undo.is_empty() || self.pending(d) } else { !self.redo.is_empty() && !self.pending(d) }
}
/// Undo Changes (`back`) or Redo Changes on `d`: give it the fields of the step before or after.
/// Returns false when there is none.
fn step(&mut self, d: &mut Dialog, back: bool) -> bool {
self.note(d);
let (from, to) = if back { (&mut self.undo, &mut self.redo) } else { (&mut self.redo, &mut self.undo) };
let Some(s) = from.pop() else { return false };
to.extend(self.base.take());
for k in STEP_FIELDS.iter().chain(&STEP_MARKS) {
match s.get(*k) {
Some(v) => d.fields.insert(k.to_string(), v.clone()),
None => d.fields.remove(*k),
};
}
// The rows hold no slider edit or drag, and the selection keeps to them.
for k in [COMPS, DRAG, BAR_DRAG, SHUFFLED] {
d.fields.remove(k);
}
let n = rows(d).len();
d.fields.insert("__sel".into(), json!(selection(d).into_iter().filter(|i| *i < n).collect::<Vec<_>>()));
self.base = Some(s);
true
}
}
/// Undo Changes (`ui.recolorUndo`, `back`) or Redo Changes (`ui.recolorRedo`) in the open Recolor
/// Artwork dialog → {changed, canUndo, canRedo}.
pub(crate) fn step(app: &mut VectorcraftApp, back: bool) -> Result<Value, String> {
if app.ui.dialog.as_ref().is_none_or(|d| d.kind != KIND) {
return Err("Recolor Artwork is not open".into());
}
let Some(mut d) = app.ui.dialog.take() else { return Err("Recolor Artwork is not open".into()) };
// Fields set since the last frame take effect first, as the next frame would give them.
seed(app, &d);
sync(app, &mut d);
sync_theme(app, &mut d);
sync_weights(app, &mut d);
let mut h = std::mem::take(&mut app.ui.recolor_history);
let changed = h.step(&mut d, back);
let r = json!({"changed": changed, "canUndo": h.can(&d, true), "canRedo": h.can(&d, false)});
app.ui.recolor_history = h;
app.ui.dialog = Some(d);
Ok(r)
}
/// Whether Undo Changes (`back`) or Redo Changes can run: Recolor Artwork is open with a step to go to.
pub(crate) fn can_step(app: &VectorcraftApp, back: bool) -> bool {
app.ui.dialog.as_ref().filter(|d| d.kind == KIND).is_some_and(|d| app.ui.recolor_history.can(d, back))
}
/// OK: keep the previewed recolour as one undo step (or apply it, e.g. to a colour group only; or
/// save colours opened alone as a new colour group).
fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
@@ -834,9 +997,12 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
sync_weights(app, &mut d);
if d.bool("__newGroup") {
let colors = group_colors(app, &d, rows(&d).iter().filter(|r| in_group(r)));
return form::commit_preview(app, "swatch.newGroup", json!({"name": d.str("groupName"), "colors": colors, "keepModel": true}));
let r = form::commit_preview(app, "swatch.newGroup", json!({"name": d.str("groupName"), "colors": colors, "keepModel": true}))?;
app.ui.recolor_history = History::default();
return Ok(r);
}
let r = form::commit_preview(app, CMD, apply_params(&d))?;
app.ui.recolor_history = History::default();
// The Preserve checkboxes (shown with art) open as confirmed here next time (#2960).
if d.bool("__art") {
app.ui.recolor_preserve =
@@ -2801,4 +2967,42 @@ mod tests {
let g = app.session.doc().unwrap().doc.swatch_groups.last().expect("a new color group");
assert_eq!(g.swatches.iter().filter_map(|w| w.paint.color()).collect::<Vec<_>>(), [Color::rgb8(255, 128, 0)]);
}
/// Undo Changes keeps at most [`MAX_STEPS`] steps and [`MAX_STEP_BYTES`] of them, the oldest
/// going first; fields that change nothing make no step, and fields larger than the limit
/// leave nothing to undo.
#[test]
fn undo_changes_keeps_a_bounded_history() {
let mut d = Dialog::new(KIND, json!({"rows": [], "colors": null}));
let mut h = History::default();
h.note(&d);
h.note(&d);
assert!(h.undo.is_empty(), "no change, no step");
for n in 0..MAX_STEPS + 6 {
d.fields.insert("colors".into(), json!(n));
h.note(&d);
}
assert_eq!(h.undo.len(), MAX_STEPS, "the oldest steps go first");
assert_eq!(h.undo[0]["colors"], json!(5));
// Rows of 100 KiB each: the steps kept stay within the byte limit.
let big = |n: usize| json!([{"from": [format!("{n}{}", "x".repeat(100 << 10))], "to": null}]);
for n in 0..60 {
d.fields.insert("rows".into(), big(n));
h.note(&d);
}
let size = |s: &Snapshot| serde_json::to_vec(s).unwrap().len();
let total: usize = h.base.iter().chain(&h.undo).map(size).sum();
assert!(total <= MAX_STEP_BYTES, "{total}");
assert!(h.undo.len() < 60 && !h.undo.is_empty(), "{}", h.undo.len());
assert!(h.step(&mut d, true), "the newest step is kept");
assert_eq!(d.fields["rows"], big(58));
// Current fields past the limit alone: nothing is left to undo before them.
d.fields.insert("rows".into(), json!([{"from": ["x".repeat(MAX_STEP_BYTES)], "to": null}]));
h.note(&d);
assert!(h.undo.is_empty() && h.redo.is_empty());
assert!(!h.can(&d, true));
d.fields.insert("colors".into(), json!(1));
assert!(!h.step(&mut d, true), "a step of them is not kept either");
assert_eq!(d.fields["colors"], json!(1), "and the fields stay as they are");
}
}
+3
View File
@@ -2973,6 +2973,9 @@ digits Malayalam Малаялам
Rotate View to Selection Завъртане на изгледа спрямо селекцията
Reset the rows to the artwork's colors Нулиране на редовете към цветовете на илюстрацията
Color Theme Picker Избор на цветова тема
Undo Changes Отмяна на промените
Redo Changes Повторение на промените
@msg Recolor Artwork is not open „Преоцветяване на илюстрацията“ не е отворено
Click or drag across the art to pick its colors; Shift adds more Щракнете или плъзнете през илюстрацията, за да вземете цветовете ѝ; Shift добавя още
Prominent Colors Преобладаващи цветове
Save All Colors Запази всички цветове
Can't render this file because it is too large.
+3
View File
@@ -2971,6 +2971,9 @@ digits Malayalam Malajalam
Recolor this row Ponovo oboji ovaj red
Reset the rows to the artwork's colors Vrati redove na boje crteža
Color Theme Picker Birač teme boja
Undo Changes Poništi promjene
Redo Changes Ponovi promjene
@msg Recolor Artwork is not open Ponovo oboji crtež nije otvoreno
Click or drag across the art to pick its colors; Shift adds more Kliknite ili prevucite preko crteža da uzmete njegove boje; Shift dodaje još
Prominent Colors Istaknute boje
Save All Colors Sačuvaj sve boje
Can't render this file because it contains an unexpected character in line 2 and column 73.
+3
View File
@@ -3788,6 +3788,9 @@ digits Malayalam Malaiàlam
Reset Ruler Origin Restableix l’origen de les regles
Reset the rows to the artwork's colors Restableix les files als colors de l’obra
Color Theme Picker Selector de tema de colors
Undo Changes Desfés els canvis
Redo Changes Refés els canvis
@msg Recolor Artwork is not open Recoloreix la il·lustració no és obert
Click or drag across the art to pick its colors; Shift adds more Feu clic o arrossegueu sobre l’obra per agafar-ne els colors; Maj n’afegeix més
Prominent Colors Colors predominants
Save All Colors Desa tots els colors
Can't render this file because it contains an unexpected character in line 2 and column 73.
+3
View File
@@ -3055,6 +3055,9 @@ digits Malayalam Malajálamské
Recolor this row Přebarvit tento řádek
Reset the rows to the artwork's colors Obnovit řádky na barvy kresby
Color Theme Picker Výběr barevného motivu
Undo Changes Vrátit změny
Redo Changes Zopakovat změny
@msg Recolor Artwork is not open Přebarvit kresbu není otevřené
Click or drag across the art to pick its colors; Shift adds more Klepnutím nebo tažením přes kresbu převezmete její barvy; Shift přidá další
Prominent Colors Převládající barvy
Save All Colors Uložit všechny barvy
Can't render this file because it is too large.
+3
View File
@@ -5528,6 +5528,9 @@ digits Malayalam Malayalam
Recolor this row Omfarv denne række
Reset the rows to the artwork's colors Nulstil rækkerne til grafikkens farver
Color Theme Picker Farvetemavælger
Undo Changes Fortryd ændringer
Redo Changes Gentag ændringer
@msg Recolor Artwork is not open Omfarv grafik er ikke åben
Click or drag across the art to pick its colors; Shift adds more Klik eller træk hen over grafikken for at hente dens farver; Skift tilføjer flere
Prominent Colors Fremtrædende farver
Save All Colors Gem alle farver
Can't render this file because it is too large.
+3
View File
@@ -3025,6 +3025,9 @@ digits Malayalam Malayalam
Rotate View to Selection Ansicht nach Auswahl drehen
Reset the rows to the artwork's colors Zeilen auf die Farben der Grafik zurücksetzen
Color Theme Picker Farbthema-Auswahl
Undo Changes Änderungen rückgängig machen
Redo Changes Änderungen wiederholen
@msg Recolor Artwork is not open „Grafik neu färben“ ist nicht geöffnet
Click or drag across the art to pick its colors; Shift adds more Klicken oder ziehen Sie über die Grafik, um ihre Farben aufzunehmen; Umschalt fügt weitere hinzu
Prominent Colors Hervorstechende Farben
Save All Colors Alle Farben speichern
Can't render this file because it is too large.
+3
View File
@@ -3846,6 +3846,9 @@ digits Malayalam Μαλαγιάλαμ
Rotate View to Selection Περιστροφή προβολής ως προς την επιλογή
Reset the rows to the artwork's colors Επαναφορά γραμμών στα χρώματα του σχεδίου
Color Theme Picker Επιλογέας χρωματικού θέματος
Undo Changes Αναίρεση αλλαγών
Redo Changes Επανάληψη αλλαγών
@msg Recolor Artwork is not open ο Επαναχρωματισμός σχεδίου δεν είναι ανοιχτός
Click or drag across the art to pick its colors; Shift adds more Κάντε κλικ ή σύρετε πάνω στο σχέδιο για να πάρετε τα χρώματά του· το Shift προσθέτει κι άλλα
Prominent Colors Κυρίαρχα χρώματα
Save All Colors Αποθήκευση όλων των χρωμάτων
Can't render this file because it is too large.
+3
View File
@@ -3063,6 +3063,9 @@ digits Malayalam Malayálam
Rotate View to Selection Rotar vista según la selección
Reset the rows to the artwork's colors Restablecer las filas a los colores de la ilustración
Color Theme Picker Selector de tema de color
Undo Changes Deshacer cambios
Redo Changes Rehacer cambios
@msg Recolor Artwork is not open Volver a colorear ilustración no está abierto
Click or drag across the art to pick its colors; Shift adds more Haga clic o arrastre sobre la ilustración para tomar sus colores; Mayús añade más
Prominent Colors Colores destacados
Save All Colors Guardar todos los colores
Can't render this file because it contains an unexpected character in line 2 and column 73.
+3
View File
@@ -2999,6 +2999,9 @@ digits Malayalam Malajalam
Recolor this row Väritä tämä rivi uudelleen
Reset the rows to the artwork's colors Palauta rivit kuvituksen väreihin
Color Theme Picker Väriteeman valitsin
Undo Changes Kumoa muutokset
Redo Changes Tee muutokset uudelleen
@msg Recolor Artwork is not open Väritä kuvitus uudelleen ei ole auki
Click or drag across the art to pick its colors; Shift adds more Napsauta tai vedä kuvituksen yli poimiaksesi sen värit; Vaihto lisää useampia
Prominent Colors Hallitsevat värit
Save All Colors Tallenna kaikki värit
Can't render this file because it contains an unexpected character in line 2 and column 73.
+3
View File
@@ -3051,6 +3051,9 @@ digits Malayalam Malayalam
Rotate View to Selection Faire pivoter l’affichage selon la sélection
Reset the rows to the artwork's colors Réinitialiser les lignes avec les couleurs de l’illustration
Color Theme Picker Sélecteur de thème de couleurs
Undo Changes Annuler les modifications
Redo Changes Rétablir les modifications
@msg Recolor Artwork is not open Redéfinir les couleurs de l’illustration n’est pas ouvert
Click or drag across the art to pick its colors; Shift adds more Cliquez ou faites glisser sur l’illustration pour prélever ses couleurs ; Maj en ajoute d’autres
Prominent Colors Couleurs dominantes
Save All Colors Enregistrer toutes les couleurs
Can't render this file because it is too large.
+3
View File
@@ -4632,6 +4632,9 @@ antiAlias Sharp શાર્પ
Edit Arrowheads… એરોહેડ્સ સંપાદિત કરો…
Reload Arrowheads એરોહેડ્સ ફરી લોડ કરો
Color Theme Picker કલર થીમ પિકર
Undo Changes ફેરફારો પૂર્વવત્ કરો
Redo Changes ફેરફારો ફરીથી કરો
@msg Recolor Artwork is not open કલાકૃતિનો રંગ બદલો ખુલ્લું નથી
Click or drag across the art to pick its colors; Shift adds more આર્ટના રંગો પસંદ કરવા તેના પર ક્લિક કરો અથવા ડ્રેગ કરો; Shiftથી વધુ ઉમેરાય છે
Prominent Colors મુખ્ય રંગો
Save All Colors બધા રંગો સાચવો
Can't render this file because it contains an unexpected character in line 72 and column 5.
+3
View File
@@ -4156,6 +4156,9 @@ antiAlias Sharp शार्प
Reset Text Transform and Scale टेक्स्ट ट्रांसफॉर्म और स्केल को रीसेट करें
Reset the rows to the artwork's colors आर्टवर्क के रंग के लिए पंक्तियों को रीसेट करें
Color Theme Picker रंग थीम पिकर
Undo Changes परिवर्तन पूर्ववत करें
Redo Changes परिवर्तन फिर से करें
@msg Recolor Artwork is not open Recolor Artwork खुला नहीं है
Click or drag across the art to pick its colors; Shift adds more आर्टवर्क के रंग लेने के लिए उस पर क्लिक करें या खींचें; Shift और जोड़ता है
Prominent Colors प्रमुख रंग
Save All Colors सभी रंग सेव करें
Can't render this file because it is too large.
+3
View File
@@ -3630,6 +3630,9 @@ mark-style Japanese Japán
Rotate View to Selection Nézet elforgatása a kijelöléshez
Reset the rows to the artwork's colors Sorok visszaállítása a grafika színeire
Color Theme Picker Színtéma-választó
Undo Changes Módosítások visszavonása
Redo Changes Módosítások újra
@msg Recolor Artwork is not open A Grafika átszínezése nincs megnyitva
Click or drag across the art to pick its colors; Shift adds more Kattintson vagy húzzon a grafikán a színei felvételéhez; a Shift továbbiakat ad hozzá
Prominent Colors Domináns színek
Save All Colors Összes szín mentése
Can't render this file because it is too large.
+3
View File
@@ -2780,6 +2780,9 @@ digits Malayalam Malayalam
Recolor this row Warnai ulang baris ini
Reset the rows to the artwork's colors Setel ulang baris ke warna karya seni
Color Theme Picker Pemilih tema warna
Undo Changes Urungkan perubahan
Redo Changes Ulangi perubahan
@msg Recolor Artwork is not open Warnai ulang karya seni tidak terbuka
Click or drag across the art to pick its colors; Shift adds more Klik atau seret melintasi karya seni untuk mengambil warnanya; Shift menambahkan lagi
Prominent Colors Warna menonjol
Save All Colors Simpan semua warna
Can't render this file because it contains an unexpected character in line 2511 and column 5.
+3
View File
@@ -3106,6 +3106,9 @@ digits Malayalam Malayalam
Rotate View to Selection Ruota vista in base alla selezione
Reset the rows to the artwork's colors Reimposta le righe sui colori della grafica
Color Theme Picker Selettore tema colore
Undo Changes Annulla modifiche
Redo Changes Ripeti modifiche
@msg Recolor Artwork is not open Ricolora grafica non è aperto
Click or drag across the art to pick its colors; Shift adds more Fai clic o trascina sulla grafica per prelevarne i colori; Maiusc ne aggiunge altri
Prominent Colors Colori prominenti
Save All Colors Salva tutti i colori
Can't render this file because it is too large.
+3
View File
@@ -3087,6 +3087,9 @@ mark-style Japanese 日本式
Reload Arrowheads 矢印を再読み込み
Reset the rows to the artwork's colors 行をアートワークのカラーにリセット
Color Theme Picker カラーテーマピッカー
Undo Changes 変更を取り消し
Redo Changes 変更をやり直し
@msg Recolor Artwork is not open 「アートワークを再配色」が開いていません
Click or drag across the art to pick its colors; Shift adds more アートワークをクリックまたはドラッグしてカラーを取得します。Shift キーで追加します
Prominent Colors 主要カラー
Save All Colors すべてのカラーを保存
Can't render this file because it is too large.
+3
View File
@@ -4943,6 +4943,9 @@ digits Malayalam მალაიალამური
Recolor this row ამ სტრიქონის ხელახლა შეფერადება
Reset the rows to the artwork's colors სტრიქონებისთვის ნახატის ფერების დაბრუნება
Color Theme Picker ფერთა თემის ამრჩევი
Undo Changes ცვლილებების გაუქმება
Redo Changes ცვლილებების ხელახლა შესრულება
@msg Recolor Artwork is not open „ნახატის ხელახლა შეფერადება“ გახსნილი არ არის
Click or drag across the art to pick its colors; Shift adds more დაწკაპეთ ან გადაატარეთ ნახატზე მისი ფერების ასაღებად; Shift ამატებს კიდევ
Prominent Colors გამოკვეთილი ფერები
Save All Colors ყველა ფერის შენახვა
Can't render this file because it is too large.
+3
View File
@@ -3076,6 +3076,9 @@ mark-style Japanese 일본식
Reload Arrowheads 화살촉 다시 불러오기
Reset the rows to the artwork's colors 행을 아트웍 색상으로 재설정
Color Theme Picker 색상 테마 피커
Undo Changes 변경 내용 실행 취소
Redo Changes 변경 내용 다시 실행
@msg Recolor Artwork is not open 아트웍 색상 재지정이 열려 있지 않습니다
Click or drag across the art to pick its colors; Shift adds more 아트웍을 클릭하거나 드래그하여 색상을 가져옵니다. Shift 키로 더 추가합니다
Prominent Colors 주요 색상
Save All Colors 모든 색상 저장
Can't render this file because it is too large.
+3
View File
@@ -3402,6 +3402,9 @@ digits Malayalam Malayalam
Recolor this row Deze rij opnieuw kleuren
Reset the rows to the artwork's colors De rijen herstellen naar de kleuren van de artwork
Color Theme Picker Kleurthemakiezer
Undo Changes Wijzigingen ongedaan maken
Redo Changes Wijzigingen opnieuw uitvoeren
@msg Recolor Artwork is not open Artwork herkleuren is niet geopend
Click or drag across the art to pick its colors; Shift adds more Klik of sleep over het artwork om de kleuren ervan op te nemen; Shift voegt er meer toe
Prominent Colors Prominente kleuren
Save All Colors Alle kleuren opslaan
Can't render this file because it is too large.
+3
View File
@@ -2964,6 +2964,9 @@ digits Malayalam Malajalam
Recolor this row Zmień kolory tego wiersza
Reset the rows to the artwork's colors Przywróć w wierszach kolory kompozycji
Color Theme Picker Próbnik motywu kolorów
Undo Changes Cofnij zmiany
Redo Changes Ponów zmiany
@msg Recolor Artwork is not open Okno Zmień kolory kompozycji nie jest otwarte
Click or drag across the art to pick its colors; Shift adds more Kliknij lub przeciągnij po kompozycji, aby pobrać jej kolory; Shift dodaje kolejne
Prominent Colors Dominujące kolory
Save All Colors Zapisz wszystkie kolory
Can't render this file because it is too large.
+3
View File
@@ -2557,6 +2557,9 @@ digits Malayalam Malaiala
Rotate View to Selection Girar Visualização para a Seleção
Reset the rows to the artwork's colors Redefinir as linhas para as cores da arte
Color Theme Picker Seletor de Tema de Cores
Undo Changes Desfazer Alterações
Redo Changes Refazer Alterações
@msg Recolor Artwork is not open Recolorir Arte não está aberto
Click or drag across the art to pick its colors; Shift adds more Clique ou arraste sobre a arte para pegar suas cores; Shift adiciona mais
Prominent Colors Cores Proeminentes
Save All Colors Salvar Todas as Cores
Can't render this file because it is too large.
+3
View File
@@ -3093,6 +3093,9 @@ digits Malayalam Малаялам
Rotate View to Selection Повернуть вид по выделению
Reset the rows to the artwork's colors Сбросить строки к цветам рисунка
Color Theme Picker Выбор цветовой темы
Undo Changes Отменить изменения
Redo Changes Повторить изменения
@msg Recolor Artwork is not open Окно «Перекрасить рисунок» не открыто
Click or drag across the art to pick its colors; Shift adds more Щёлкните или проведите по рисунку, чтобы взять его цвета; Shift добавляет ещё
Prominent Colors Преобладающие цвета
Save All Colors Сохранить все цвета
Can't render this file because it is too large.
+3
View File
@@ -2993,6 +2993,9 @@ digits Malayalam Malayalam
Rotate View to Selection Rotera vyn efter markeringen
Reset the rows to the artwork's colors Återställ raderna till teckningens färger
Color Theme Picker Färgtemaväljare
Undo Changes Ångra ändringar
Redo Changes Gör om ändringar
@msg Recolor Artwork is not open Färga om grafik är inte öppet
Click or drag across the art to pick its colors; Shift adds more Klicka eller dra över teckningen för att hämta dess färger; Skift lägger till fler
Prominent Colors Framträdande färger
Save All Colors Spara alla färger
Can't render this file because it is too large.
+3
View File
@@ -2830,6 +2830,9 @@ digits Malayalam Malayalam
Rotate View to Selection Görünümü Seçime Döndür
Reset the rows to the artwork's colors Satırları resmin renklerine göre sıfırlayın
Color Theme Picker Renk Teması Seçici
Undo Changes Değişiklikleri Geri Al
Redo Changes Değişiklikleri Yinele
@msg Recolor Artwork is not open Resmi Yeniden Renklendir açık değil
Click or drag across the art to pick its colors; Shift adds more Renklerini almak için resme tıklayın veya üzerinde sürükleyin; Shift daha fazlasını ekler
Prominent Colors Belirgin Renkler
Save All Colors Tüm Renkleri Kaydet
Can't render this file because it is too large.
+3
View File
@@ -3098,6 +3098,9 @@ digits Malayalam Малаялам
Rotate View to Selection Повернути вид за виділенням
Reset the rows to the artwork's colors Скинути рядки до кольорів малюнка
Color Theme Picker Вибір колірної теми
Undo Changes Скасувати зміни
Redo Changes Повторити зміни
@msg Recolor Artwork is not open Вікно «Перефарбувати малюнок» не відкрито
Click or drag across the art to pick its colors; Shift adds more Клацніть або проведіть по малюнку, щоб узяти його кольори; Shift додає ще
Prominent Colors Переважні кольори
Save All Colors Зберегти всі кольори
Can't render this file because it is too large.
+3
View File
@@ -3403,6 +3403,9 @@ mark-style Japanese Kiểu Nhật
Reset Ruler Origin Đặt lại gốc thước
Reset the rows to the artwork's colors Đặt lại các hàng về màu của tác phẩm
Color Theme Picker Bộ chọn bộ màu
Undo Changes Hoàn tác thay đổi
Redo Changes Làm lại thay đổi
@msg Recolor Artwork is not open Tô màu lại tác phẩm chưa được mở
Click or drag across the art to pick its colors; Shift adds more Nhấp hoặc kéo qua tác phẩm để lấy màu của nó; Shift để thêm
Prominent Colors Màu nổi bật
Save All Colors Lưu tất cả màu
Can't render this file because it contains an unexpected character in line 205 and column 5.
+3
View File
@@ -2957,6 +2957,9 @@ digits Malayalam 马拉雅拉姆数字
Rotate View to Selection 按所选对象旋转视图
Reset the rows to the artwork's colors 将各行重置为图稿的颜色
Color Theme Picker 色彩主题拾取器
Undo Changes 撤销更改
Redo Changes 重做更改
@msg Recolor Artwork is not open 重新着色图稿未打开
Click or drag across the art to pick its colors; Shift adds more 单击或拖过图稿以拾取其颜色;按住 Shift 可添加更多
Prominent Colors 主要颜色
Save All Colors 存储所有颜色
Can't render this file because it is too large.
+3
View File
@@ -4241,6 +4241,9 @@ digits Malayalam 馬來亞拉姆數字
Rotate View to Selection 依選取範圍旋轉檢視
Reset the rows to the artwork's colors 將各列重設為圖稿的顏色
Color Theme Picker 色彩主題選取器
Undo Changes 復原變更
Redo Changes 重做變更
@msg Recolor Artwork is not open 「重新上色圖稿」未開啟
Click or drag across the art to pick its colors; Shift adds more 按一下或拖過圖稿以選取其顏色;按住 Shift 可加入更多
Prominent Colors 主要顏色
Save All Colors 儲存所有顏色
Can't render this file because it is too large.
+2
View File
@@ -909,6 +909,8 @@ fn run_ui_part10(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result
"ui.simplifyAuto" => crate::dialogs::simplify_slider::auto(app),
"ui.simplifyMoreOptions" => crate::dialogs::simplify_slider::more_options(app),
"ui.smoothAuto" => crate::dialogs::smooth_slider::auto(app),
"ui.recolorUndo" => crate::dialogs::recolor::step(app, true),
"ui.recolorRedo" => crate::dialogs::recolor::step(app, false),
"ui.dialogReset" => crate::dialogs::reset(app),
"attributes.openUrl" => crate::panels::attributes::open_url(app, p),
"ui.javascriptFilesDialog" => crate::panels::svg_interactivity::files_dialog(app, p),
+2
View File
@@ -307,6 +307,8 @@ pub fn enabled(app: &VectorcraftApp, id: &str) -> bool {
"ui.menuDialog" => app.session.active().is_some_and(|d| !d.selection.is_empty()),
"ui.simplifyAuto" | "ui.simplifyMoreOptions" => crate::dialogs::simplify_slider::showing(app),
"ui.smoothAuto" => crate::dialogs::smooth_slider::showing(app),
"ui.recolorUndo" => crate::dialogs::recolor::can_step(app, true),
"ui.recolorRedo" => crate::dialogs::recolor::can_step(app, false),
"ui.dialogReset" => crate::dialogs::can_reset(app),
"ui.dxfOptionsDialog" => app.session.active().is_some(),
"links.editOriginal" | "links.reveal" => selected_image(app, |im| im.link.is_some()) || selected_placed(app),
+12
View File
@@ -851,6 +851,18 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"",
"{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)",
),
(
"ui.recolorUndo",
"Undo Changes",
"",
"{} the open Recolor Artwork dialog goes back one of its own color edits (rows, Colors, Method, the Preserve options, Limit to Library, the harmony rule, Global Adjust, the Color Theme Picker's picks, the Prominent Colors weights): its fields and the preview return to their values before that edit; the document's undo history is unchanged, and OK still records one undo step → {changed, canUndo, canRedo}; an error when the dialog isn't open. Each opening starts with nothing to undo",
),
(
"ui.recolorRedo",
"Redo Changes",
"",
"{} the open Recolor Artwork dialog restores the color edit ui.recolorUndo went back from last; a new edit after ui.recolorUndo leaves nothing to redo → {changed, canUndo, canRedo}; an error when the dialog isn't open",
),
(
"ui.cropImage",
"Crop Image",
+5
View File
@@ -818,6 +818,10 @@ pub struct UiState {
/// `preserveGrays`; null: never used): its dialog opens with them (#2960).
#[serde(default)]
pub recolor_preserve: Value,
/// The open Recolor Artwork dialog's own history of color edits (Undo Changes and Redo
/// Changes), empty again each time the dialog opens.
#[serde(skip)]
pub recolor_history: crate::dialogs::recolor::History,
/// The Simplify dialog's fields confirmed last with "Open this dialog with these settings next
/// time" ticked (null: not ticked): Object › Path › Simplify opens the dialog on them instead
/// of the Simplify slider.
@@ -1268,6 +1272,7 @@ impl Default for UiState {
smart_punctuation: Value::Null,
average_join: Value::Null,
recolor_preserve: Value::Null,
recolor_history: Default::default(),
simplify: Value::Null,
move_options: Value::Null,
transform_each: Value::Null,
+157
View File
@@ -1585,3 +1585,160 @@ fn row_context_menu_pick_from_swatches_and_limit_to_library() {
assert_eq!(colors(h.state_mut()), 2, "Recolor Cancel restores the original artwork");
}
}
/// Whether the dialog's button `name` is disabled.
fn disabled(h: &egui_kittest::Harness<'_, VectorcraftApp>, name: &str) -> bool {
h.get_by_role_and_label(egui::accesskit::Role::Button, name).accesskit_node().is_disabled()
}
/// Undo Changes and Redo Changes step back and forward through the dialog's own color edits, and
/// the art previews each step; the document's undo history is unchanged until OK, which records
/// one step. Both buttons start disabled, and a new edit after Undo Changes leaves nothing to redo.
#[test]
fn undo_and_redo_changes_step_through_the_dialogs_own_edits() {
let mut h = edit_harness(&["#ff0000", "#00ff00", "#0000ff"]);
let undo = h.state().session.doc().unwrap().history.undo.len();
h.get_by_role_and_label(egui::accesskit::Role::Button, "Assign").click();
h.run_steps(3);
assert!(disabled(&h, "Undo Changes") && disabled(&h, "Redo Changes"), "nothing to step to on opening");
let state = |h: &egui_kittest::Harness<'_, VectorcraftApp>| (field(h.state(), "rows"), fills(h.state()));
let start = state(&h);
h.get_by_label("Randomly change color order").click();
h.run_steps(3);
let first = state(&h);
assert_ne!(first, start, "the order changed and previews");
h.get_by_label("Randomly change saturation and brightness").click();
h.run_steps(3);
let second = state(&h);
assert_ne!(second, first);
assert!(!disabled(&h, "Undo Changes") && disabled(&h, "Redo Changes"));
for (button, want) in [("Undo Changes", &first), ("Undo Changes", &start), ("Redo Changes", &first), ("Redo Changes", &second)] {
h.get_by_role_and_label(egui::accesskit::Role::Button, button).click();
h.run_steps(3);
assert_eq!(&state(&h), want, "{button}");
}
assert_eq!(h.state().session.doc().unwrap().history.undo.len(), undo, "the dialog's steps leave the document's history alone");
h.get_by_role_and_label(egui::accesskit::Role::Button, "Undo Changes").click();
h.run_steps(3);
assert_eq!(state(&h), first);
assert!(!disabled(&h, "Redo Changes"));
h.get_by_label("Randomly change saturation and brightness").click();
h.run_steps(3);
assert!(disabled(&h, "Redo Changes"), "a new edit leaves nothing to redo");
let last = state(&h);
h.get_by_label("OK").click();
h.run_steps(2);
let app = h.state_mut();
assert!(app.ui.dialog.is_none());
assert_eq!(fills(app), last.1, "OK keeps the edits");
assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 1, "as one undo step");
app.run("edit.undo", json!({})).unwrap();
assert_eq!(fills(app), start.1);
// A new opening has nothing to undo.
app.run("select.all", json!({})).unwrap();
app.run("ui.recolorDialog", json!({})).unwrap();
h.run_steps(3);
assert!(disabled(&h, "Undo Changes") && disabled(&h, "Redo Changes"), "nothing to step to on a new opening");
h.get_by_label("Cancel").click();
h.run_steps(2);
}
/// A drag is one step from press to release: Undo Changes after dragging the Edit tab's Brightness
/// slider across several frames gives the rows the drag started on, with nothing left to undo.
#[test]
fn a_drag_is_one_step_of_undo_changes() {
let mut h = edit_harness(&["rgb 200 100 100", "rgb 100 200 200"]);
let rows = field(h.state(), "rows");
let slider = widget_of_size(&h, vec2(220.0, 22.0));
let v = new_hsb(h.state())[0][2];
let at = egui::pos2(slider.left() + 4.0 + v * (slider.width() - 8.0), slider.center().y);
h.hover_at(at);
h.run_steps(1);
h.drag_at(at);
h.run_steps(1);
for k in 1..=6 {
h.hover_at(egui::pos2(at.x + 12.0 * k as f32, at.y));
h.run_steps(1);
}
h.drop_at(egui::pos2(at.x + 72.0, at.y));
h.run_steps(2);
assert_ne!(field(h.state(), "rows"), rows, "the drag changed the colors");
h.get_by_role_and_label(egui::accesskit::Role::Button, "Undo Changes").click();
h.run_steps(3);
assert_eq!(field(h.state(), "rows"), rows, "one Undo Changes goes back to before the drag");
assert!(disabled(&h, "Undo Changes"), "the drag was one step");
assert!(!disabled(&h, "Redo Changes"));
}
/// Reset is a step of its own: Undo Changes gives back the rows Reset discarded.
#[test]
fn undo_changes_reverses_reset() {
let mut app = app();
art(&mut app, &["#ff0000", "#00ff00", "#0000ff"]);
let mut h = assign_harness(app, json!({}));
let start = field(h.state(), "rows");
h.get_by_label("Randomly change saturation and brightness").click();
h.run_steps(3);
let edited = field(h.state(), "rows");
assert_ne!(edited, start);
h.get_by_role_and_label(egui::accesskit::Role::Button, "Reset the rows to the artwork's colors").click();
h.run_steps(3);
assert_eq!(field(h.state(), "rows"), start, "Reset reads the art's colors");
h.get_by_role_and_label(egui::accesskit::Role::Button, "Undo Changes").click();
h.run_steps(3);
assert_eq!(field(h.state(), "rows"), edited, "Undo Changes gives back the rows before Reset");
h.get_by_role_and_label(egui::accesskit::Role::Button, "Redo Changes").click();
h.run_steps(3);
assert_eq!(field(h.state(), "rows"), start, "Redo Changes resets them again");
}
/// `ui.recolorUndo` and `ui.recolorRedo` step the open dialog as its buttons do, also through a
/// field set without a frame between, and a new count of Colors is one step that restores the count
/// and the rows; outside the dialog they are an error, and a new opening has nothing to undo.
#[test]
fn the_recolor_undo_and_redo_commands_step_the_open_dialog() {
let mut app = app();
let ctx = context();
art(&mut app, &["#ff0000", "#e01010", "#0000ff", "#1010e0"]);
assert!(app.run("ui.recolorUndo", json!({})).is_err(), "no dialog open");
// A field set before the dialog's first frame is a step back to the fields it opened with.
app.run("ui.recolorDialog", json!({})).unwrap();
set(&mut app, "colors", json!(2));
let r = app.run("ui.recolorUndo", json!({})).unwrap();
assert_eq!(r, json!({"changed": true, "canUndo": false, "canRedo": true}));
assert_eq!(field(&app, "colors"), Value::Null);
assert_eq!(field(&app, "rows").as_array().unwrap().len(), 4, "the rows of the art as it opened");
dialogs::cancel(&mut app);
app.run("select.all", json!({})).unwrap();
app.run("ui.recolorDialog", json!({})).unwrap();
dialog_frame(&mut app, &ctx);
assert!(!dialogs::recolor::can_step(&app, true) && !dialogs::recolor::can_step(&app, false));
let start = field(&app, "rows");
assert_eq!(start.as_array().unwrap().len(), 4);
set(&mut app, "colors", json!(2));
dialog_frame(&mut app, &ctx);
assert_eq!(field(&app, "rows").as_array().unwrap().len(), 2);
let two = field(&app, "rows");
set(&mut app, "globalAdjust", json!({"saturation": -50}));
dialog_frame(&mut app, &ctx);
let r = app.run("ui.recolorUndo", json!({})).unwrap();
assert_eq!(r, json!({"changed": true, "canUndo": true, "canRedo": true}));
assert_eq!((field(&app, "globalAdjust"), field(&app, "rows")), (Value::Null, two.clone()));
app.run("ui.recolorUndo", json!({})).unwrap();
dialog_frame(&mut app, &ctx);
assert_eq!((field(&app, "colors"), field(&app, "rows")), (Value::Null, start.clone()), "the count and its rows, not reduced again");
assert!(!dialogs::recolor::can_step(&app, true));
assert_eq!(app.run("ui.recolorUndo", json!({})).unwrap()["changed"], json!(false));
app.run("ui.recolorRedo", json!({})).unwrap();
assert_eq!((field(&app, "colors"), field(&app, "rows")), (json!(2), two));
// A field set without a frame between is a step before Undo Changes goes back.
set(&mut app, "method", json!("exact"));
assert_eq!(app.run("ui.recolorUndo", json!({})).unwrap()["changed"], json!(true));
assert_eq!(field(&app, "method"), json!("scaleTints"));
dialogs::cancel(&mut app);
assert!(app.run("ui.recolorRedo", json!({})).is_err(), "Cancel closed the dialog");
app.run("select.all", json!({})).unwrap();
app.run("ui.recolorDialog", json!({})).unwrap();
dialog_frame(&mut app, &ctx);
assert!(!dialogs::recolor::can_step(&app, true) && !dialogs::recolor::can_step(&app, false), "a new opening");
}
+14
View File
@@ -4856,6 +4856,20 @@ dimmed, so art that mixes colors dims only its other colors, and nothing is dimm
selected. Find changes only what the canvas shows: it records no undo step, Cancel leaves the art as it was, and OK
applies every row to the art as it does with Find off.
The Undo Changes and Redo Changes buttons beside the Color Theme Picker (`ui.recolorUndo` and `ui.recolorRedo`) go
back and forward one color edit made in the open dialog; 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)).
A step restores the rows, `colors`, `method`, the Preserve options, `limitTo`, `rule`, `globalAdjust`, `themePicks`
and `weights`, and the art previews the result. Both commands return `{changed, canUndo, canRedo}` and are an error
when Recolor Artwork is not open. VectorCraft's own rules: the dialog's history is separate from the document's undo
history, which does not change until OK records the recolor as one undo step; Cancel discards the history with the
edits. A change is one step once the pointer is released, so a drag on the wheel, a slider or the Prominent Colors bar
is one step, and an action that changes none of those fields is no step. Reset is a step of its own, which Undo
Changes reverses. A new edit after Undo Changes leaves nothing to redo. Switching tabs, displays or slider modes,
selecting rows, Find and Preview make no step. The dialog keeps at most 64 steps and 4 MiB of them as JSON, dropping
the oldest first. A button with no step to go to is disabled. Save All Colors and Save Prominent Colors add a color
group to the document at once, as its own undo step, and Undo Changes leaves that group in place.
The `recolor.*` commands refuse parameters of the wrong form. A `limitTo` or `method` that is not a string gets the
error for an unknown library or method. Other wrong-form parameters get an error that names them.
`includeImages`, `includePatterns`, a row's `exclude`, `order`, `saturationBrightness` and the `white`, `black` and
+1
View File
@@ -1766,6 +1766,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **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 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 only when OK records one undo step; a drag is one step, Reset is a step of its own, a new edit leaves nothing to redo, a button with no step to go to is disabled, and the dialog keeps at most 64 steps and 4 MiB of them. Tests: `undo_and_redo_changes_step_through_the_dialogs_own_edits`, `a_drag_is_one_step_of_undo_changes`, `undo_changes_reverses_reset` and `the_recolor_undo_and_redo_commands_step_the_open_dialog` in `crates/ui-egui/src/tests/recolor.rs`, and `undo_changes_keeps_a_bounded_history` in `crates/ui-egui/src/dialogs/recolor.rs`. Scores and estimates unchanged.
- **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.