From 4c5c25c4e4147cd32e14971efa96a923514a1210 Mon Sep 17 00:00:00 2001 From: paaspaas00 <151774837+paaspaas00@users.noreply.github.com> Date: Wed, 21 Oct 2026 14:24:41 +0200 Subject: [PATCH] Swatches: a Paper swatch is editable whatever its name Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/swatches.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/swatches.rs b/crates/ui-egui/src/panels/swatches.rs index 32bc9e128..bbb4b21a9 100644 --- a/crates/ui-egui/src/panels/swatches.rs +++ b/crates/ui-egui/src/panels/swatches.rs @@ -254,7 +254,8 @@ enum RowMode { fn row_marks(sw: &designcraft_color::swatch::Swatch) -> RowMarks { use designcraft_color::Color; - let not_editable = sw.locked && sw.name != designcraft_color::swatch::PAPER; + // Paper's colour can be edited, whatever the swatch is called (as the options dialog allows). + let not_editable = sw.locked && !matches!(sw.value, SwatchValue::Paper { .. }); match &sw.value { SwatchValue::Color { color, color_type } => { let mode = match color { @@ -1312,5 +1313,9 @@ mod row_mark_tests { ..cyan.clone() }; assert_eq!(row_marks(&spot), RowMarks { not_editable: false, kind: Some(ColorType::Spot), mode: Some(RowMode::Rgb) }); + // A locked Paper swatch under another name (a document from elsewhere) is still editable. + let paper = all.iter().find(|s| s.name == designcraft_color::swatch::PAPER).unwrap(); + let renamed = designcraft_color::swatch::Swatch { name: "Papier".into(), ..paper.clone() }; + assert!(!row_marks(&renamed).not_editable); } }