From ab821a776bcc630564b0ebe1b48cdcb1ea8a0796 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 24 Oct 2026 20:35:08 -0700 Subject: [PATCH] Symbol Stainer: stained type keeps no link to a global swatch The Symbol Stainer mixed the color of type characters painted with a global swatch but kept the swatch name and tint, so the characters' paint named a swatch whose color it no longer had, and a later edit of the swatch could put the unstained color back. Their fill and stroke now become plain colors, as a path's paint does. --- crates/brush/src/colorize.rs | 2 +- crates/brush/src/tests.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/brush/src/colorize.rs b/crates/brush/src/colorize.rs index 80d302b66..9ef049f86 100644 --- a/crates/brush/src/colorize.rs +++ b/crates/brush/src/colorize.rs @@ -119,7 +119,7 @@ pub fn tint_node(n: &mut Node, color: &Color, amount: f32) { for r in &mut t.runs { for p in [&mut r.style.fill, &mut r.style.stroke] { if let Paint::Solid { color: c, .. } = p { - *c = c.lerp(color, amount); + *p = Paint::solid(c.lerp(color, amount)); } } } diff --git a/crates/brush/src/tests.rs b/crates/brush/src/tests.rs index 8c04e102b..5a665809f 100644 --- a/crates/brush/src/tests.rs +++ b/crates/brush/src/tests.rs @@ -363,6 +363,12 @@ fn stain_mixes_type_strokes_too() { let mut art = type_art(red.clone(), red); tint_node(&mut art, &blue, 1.0); assert_eq!(run_paints(&[art]), [(Paint::solid(blue), Paint::solid(blue))]); + // Characters painted with a global swatch lose the link, as a path's paint does: the mixed color + // is not the swatch's color. + let linked = Paint::Solid { color: Color::rgb(1.0, 0.0, 0.0), swatch: Some("Red".into()), tint: 0.5 }; + let mut art = type_art(linked.clone(), linked); + tint_node(&mut art, &blue, 1.0); + assert_eq!(run_paints(&[art]), [(Paint::solid(blue), Paint::solid(blue))]); } #[test]