Color Effects: Randomize Fill Colors documents that colors follow the ids order

The MCP guide and the command help now say that colors are drawn in the
order ids lists the objects, so the same seed can give each object a
different color when the order changes.

The graph design test also covers copies that keep the design flag while
the series no longer names a design, so the flag alone keeps their fills.
This commit is contained in:
dotCooCoo committed 2026-11-29 21:56:00 -08:00
1 parent 5fccf73431
commit 845544618c
3 files changed
+24 -5

No files matched your search

+1 -1
View File
@@ -99,7 +99,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Randomize Fill Colors",
["Object", "Plug-ins", "Color Effects"],
None,
"{scheme?: \"color\" (any color: red, green and blue each at random, in the document's color mode) | \"tint\" (a tint of `swatch`, linked to it) | \"gray\" (a gray) (\"color\"), swatch?: a global or spot color swatch's name (tint only, and needed there; a tint swatch gives tints of its base, which must still support tints), min?: % 0..100 (0), max?: % 0..100 (100; not less than min) (tint and gray only: the tint, or the gray's black, ranges from min to max), seed?: whole number (0; the same seed, objects and settings give the same colors), ids?: [id…] (default: the selection)} give each selected filled path, compound path and live compound shape, and each one inside the selected groups, its own top fill color, picked at random and evenly within the scheme, as one undo step (none when no fill changes). Compound paths and live compound shapes take one color and keep their members' fills. An id naming a nested member targets the outermost compound. Paths, compound paths and live compound shapes with no fill, clipping paths, hidden and locked objects (and objects in hidden or locked groups and layers, or on a locked artboard, also when given in ids, except new art made there while it is still selected), generated graph design art, paths a user groups inside a graph series, type, images, symbol instances, blends and envelopes keep their fills; a gradient or pattern fill becomes the color. On paths directly in a graph series whose fill changes, the graph stores the fill of the frontmost of them for its next redraw, which gives every mark of the series that one color (docs/mcp.md) → {count: objects whose fill changed}",
"{scheme?: \"color\" (any color: red, green and blue each at random, in the document's color mode) | \"tint\" (a tint of `swatch`, linked to it) | \"gray\" (a gray) (\"color\"), swatch?: a global or spot color swatch's name (tint only, and needed there; a tint swatch gives tints of its base, which must still support tints), min?: % 0..100 (0), max?: % 0..100 (100; not less than min) (tint and gray only: the tint, or the gray's black, ranges from min to max), seed?: whole number (0; the same seed, objects and settings give the same colors; colors are drawn in the order of ids, a repeated id counting once and an id inside a listed group taking its color with that group's objects, so another order can give each object a different color), ids?: [id…] (default: the selection)} give each selected filled path, compound path and live compound shape, and each one inside the selected groups, its own top fill color, picked at random and evenly within the scheme, as one undo step (none when no fill changes). Compound paths and live compound shapes take one color and keep their members' fills. An id naming a nested member targets the outermost compound. Paths, compound paths and live compound shapes with no fill, clipping paths, hidden and locked objects (and objects in hidden or locked groups and layers, or on a locked artboard, also when given in ids, except new art made there while it is still selected), generated graph design art, paths a user groups inside a graph series, type, images, symbol instances, blends and envelopes keep their fills; a gradient or pattern fill becomes the color. On paths directly in a graph series whose fill changes, the graph stores the fill of the frontmost of them for its next redraw, which gives every mark of the series that one color (docs/mcp.md) → {count: objects whose fill changed}",
has_selection,
random_fill::run
),
@@ -440,7 +440,10 @@ fn grouped_paths_in_a_graph_series_keep_their_fills_as_for_paint_set_fill() {
#[test]
fn generated_compound_design_copies_in_a_graph_series_keep_their_fills() {
for (kind, legacy) in ["column", "line", "scatter"].into_iter().flat_map(|kind| [false, true].map(|legacy| (kind, legacy))) {
// `legacy` clears the design flags and keeps the series' design reference; `flag_only` keeps the flags and clears the
// reference, so each check keeps the copies' fills on its own.
let modes = [(false, false), (true, false), (false, true)];
for (kind, (legacy, flag_only)) in ["column", "line", "scatter"].into_iter().flat_map(|kind| modes.map(|mode| (kind, mode))) {
let mut s = session();
let marks = rects(&mut s, 2);
select(&mut s, &marks);
@@ -483,10 +486,24 @@ fn generated_compound_design_copies_in_a_graph_series_keep_their_fills() {
})
.unwrap();
}
if flag_only {
s.edit("Clear series design reference", |d, _| {
let mut extras = d.node_mut(graph).unwrap().extras_mut();
let spec = extras.graph.as_deref_mut().unwrap();
spec.series_columns.iter_mut().for_each(|c| *c = None);
spec.series_markers.iter_mut().for_each(|m| *m = None);
Ok(())
})
.unwrap();
for id in &copies {
assert!(s.doc().unwrap().doc.node(*id).unwrap().extras().graph_design_art, "{kind}");
}
}
let before = fills(&s, &art);
for ids in [vec![graph], vec![group], copies] {
let runs = if flag_only { vec![copies.clone()] } else { vec![vec![graph], vec![group], copies] };
for ids in runs {
s.execute(C, &json!({"scheme": "gray", "min": 40, "max": 40, "ids": ids.iter().map(|i| i.0).collect::<Vec<_>>()})).unwrap();
assert_eq!(fills(&s, &art), before, "{kind}, legacy: {legacy}: {ids:?}");
assert_eq!(fills(&s, &art), before, "{kind}, legacy: {legacy}, flag only: {flag_only}: {ids:?}");
}
}
}
+3 -1
View File
@@ -17276,7 +17276,9 @@ groups, a top fill color of its own, picked at random and evenly, as one undo st
`min` and `max` are 0 to 100 (0 and 100 when left out) and go with `tint` and `gray` only; `swatch` goes with `tint`
only and is needed there (a tint swatch gives tints of its base, which must still support tints). The same `seed` (a whole number, 0 when left out),
objects and settings give the same colors. Compound paths and live compound shapes take one color and keep their members' fills.
objects and settings give the same colors. The colors are drawn in the order `ids` lists the objects, a repeated id counting once and an id inside a listed group
taking its color when that group's objects are colored,
so with the ids in another order the same seed can give each object a different color. Compound paths and live compound shapes take one color and keep their members' fills.
An id naming a nested member targets the outermost compound.
Paths, compound paths and live compound shapes with no fill, clipping paths (a compound path that
clips included), hidden and locked objects and the objects in hidden or locked groups and layers or on a locked artboard (also when `ids` names them; new art made there while it is still selected takes a color), generated graph design art, paths a user groups inside a graph series, type, images, symbol instances, blends and envelopes keep their fills; a gradient or pattern fill is replaced by