From af086dc145e8b678f2fc4c840b2f76f52d187f2a Mon Sep 17 00:00:00 2001 From: aiongg Date: Fri, 16 Oct 2026 03:25:55 +0000 Subject: [PATCH] Integration: the Gradient panel and Swatch Options send CMYK in model form Main reads bare CMYK as 0..100 (#910), so the fractions both UIs sent turned M 100 % into M 1 %. The {model: cmyk} form takes fractions. --- crates/ui-egui/src/dialogs/options.rs | 2 +- crates/ui-egui/src/panels/swatches.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/dialogs/options.rs b/crates/ui-egui/src/dialogs/options.rs index abec47b45..d8aba2bea 100644 --- a/crates/ui-egui/src/dialogs/options.rs +++ b/crates/ui-egui/src/dialogs/options.rs @@ -84,7 +84,7 @@ fn dialog_color(f: &Map) -> Option { /// A colour as `swatch.options` takes it (fractions, so 1% isn't read as 100%). fn color_json(c: Color) -> Value { match c { - Color::Cmyk { c, m, y, k } => json!({"c": c, "m": m, "y": y, "k": k}), + Color::Cmyk { c, m, y, k } => json!({"model": "cmyk", "c": c, "m": m, "y": y, "k": k}), Color::Rgb { r, g, b } => json!([r, g, b]), Color::Gray { k } => json!({"gray": k}), } diff --git a/crates/ui-egui/src/panels/swatches.rs b/crates/ui-egui/src/panels/swatches.rs index fd0086ead..35c264657 100644 --- a/crates/ui-egui/src/panels/swatches.rs +++ b/crates/ui-egui/src/panels/swatches.rs @@ -575,8 +575,8 @@ pub struct SwatchDrag(pub String); fn color_json(c: &designcraft_color::Color) -> serde_json::Value { use designcraft_color::Color; match *c { - // Fractions: every component is within 0–1, so they're read back as fractions. - Color::Cmyk { c, m, y, k } => json!({"c": c, "m": m, "y": y, "k": k}), + // The model form takes fractions; bare CMYK would be read as 0..100. + Color::Cmyk { c, m, y, k } => json!({"model": "cmyk", "c": c, "m": m, "y": y, "k": k}), Color::Gray { k } => json!({"model": "gray", "k": k}), Color::Rgb { .. } => json!(c.to_hex()), }