mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-16 12:03:31 +00:00
Merge pull request #7988 from dotCooCoo/fix/recolor-empty-new-rows-left-out
Recolor Artwork: Save All Colors, the Edit tab and Color Theme Picker leave empty New Row rows out
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
//! CMYK or Lab, and Tint when the new color is a spot color of the library), which edit the
|
||||
//! first selected row's new color (once they have, OK gives the art each new color in its own
|
||||
//! model), New Row (a row with no current colors above the first selected row, or at the top,
|
||||
//! with that row's new color; it recolors nothing until Merge moves colors into it), Merge and
|
||||
//! with that row's new color; it recolors nothing until Merge moves colors into it, and until then
|
||||
//! the Edit tab, the Color Theme Picker and Save All Colors leave it out), Merge and
|
||||
//! Separate, Randomize order or
|
||||
//! saturation and brightness, Find (with it on, the art of the selected rows shows as the preview
|
||||
//! shows it, their current colors with Preview off, and the rest of the selected art shows its
|
||||
@@ -38,9 +39,9 @@
|
||||
//! The Color Theme Picker button beside the tabs turns on picking from the canvas: a click on an
|
||||
//! object takes the palette of the object a Selection tool click takes, a drag takes the palette
|
||||
//! of the art inside its marquee, and Shift adds to the picks so far (`recolor.pickTheme`). The
|
||||
//! rows that aren't excluded take the picked colors as their new colors, 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.
|
||||
//! rows that aren't excluded and hold current colors take the picked colors as their new colors,
|
||||
//! 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.
|
||||
//!
|
||||
//! Fields (`ui.dialog.set`): `rows` ([{from: [keys], to: key, exclude?, tint?: percent of a spot
|
||||
//! color}]), `colors` (null: Auto, or a count), `method`, `preserveWhite`, `preserveBlack`,
|
||||
@@ -391,14 +392,15 @@ fn group_colors<'a>(app: &VectorcraftApp, d: &Dialog, rs: impl Iterator<Item = &
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The New Color Group menu's request: save the new colors of the rows that aren't excluded (Save
|
||||
/// All Colors, in row order; a row without one gives its first current color) or of the Prominent Colors bar (Save Prominent Colors, in its order)
|
||||
/// as a new color group, a step of its own (`swatch.newGroup`).
|
||||
/// The New Color Group menu's request: save the new colors of the rows that aren't excluded and
|
||||
/// hold current colors (Save All Colors, in row order; a row without one gives its first current
|
||||
/// color) or of the Prominent Colors bar (Save Prominent Colors, in its order) as a new color
|
||||
/// group, a step of its own (`swatch.newGroup`).
|
||||
fn save_group(app: &mut VectorcraftApp, d: &mut Dialog, which: &str) {
|
||||
let rs = rows(d);
|
||||
let order: Vec<usize> = match which {
|
||||
"prominent" => prominent_parts(d, &rs).into_iter().map(|p| p.0).collect(),
|
||||
_ => (0..rs.len()).filter(|&i| !excluded(&rs[i])).collect(),
|
||||
_ => (0..rs.len()).filter(|&i| in_group(&rs[i])).collect(),
|
||||
};
|
||||
let colors = group_colors(app, d, order.iter().filter_map(|&i| rs.get(i)));
|
||||
if colors.is_empty() {
|
||||
@@ -417,10 +419,10 @@ const THEME_PICKER: &str = "themePicker";
|
||||
const THEME_PICKS: &str = "themePicks";
|
||||
const THEME_DONE: &str = "__themePicked";
|
||||
|
||||
/// When the picks of the Color Theme Picker changed, give the rows that aren't excluded the
|
||||
/// palette of the art picked (`recolor.pickTheme`, as many colors as those rows), in row order;
|
||||
/// with fewer colors than rows, the colors repeat. Picks that touch no art leave the rows as they
|
||||
/// are.
|
||||
/// When the picks of the Color Theme Picker changed, give the rows that aren't excluded and hold
|
||||
/// current colors the palette of the art picked (`recolor.pickTheme`, as many colors as those
|
||||
/// rows), in row order; with fewer colors than rows, the colors repeat. Picks that touch no art
|
||||
/// leave the rows as they are.
|
||||
fn sync_theme(app: &mut VectorcraftApp, d: &mut Dialog) {
|
||||
let picks = d.fields.get(THEME_PICKS).cloned().unwrap_or(Value::Null);
|
||||
if !picks.as_array().is_some_and(|a| !a.is_empty()) || d.fields.get(THEME_DONE) == Some(&picks) {
|
||||
@@ -559,6 +561,18 @@ fn excluded(row: &Value) -> bool {
|
||||
row["exclude"].as_bool().unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Whether `row` holds no current colors: a row made with New Row, until colors are merged into it.
|
||||
/// Its new color recolors nothing and is no color of a color group, the wheel or the harmony rules.
|
||||
fn empty(row: &Value) -> bool {
|
||||
row["from"].as_array().is_some_and(Vec::is_empty)
|
||||
}
|
||||
|
||||
/// Whether `row`'s new color is one of the colors a color group takes: the row isn't excluded and
|
||||
/// holds current colors.
|
||||
fn in_group(row: &Value) -> bool {
|
||||
!excluded(row) && !empty(row)
|
||||
}
|
||||
|
||||
/// The seed for the next Randomize: one past the last, held at `u64::MAX`.
|
||||
fn next_seed(d: &Dialog) -> u64 {
|
||||
(d.f64("__seed", 0.0) as u64).saturating_add(1)
|
||||
@@ -574,7 +588,7 @@ fn apply_params(d: &Dialog) -> Value {
|
||||
let rs = rows(d);
|
||||
let group = d.fields.get("group").and_then(Value::as_str).map(|g| {
|
||||
// A row made with New Row that holds no current colors gives the group no color.
|
||||
let filled: Vec<&Value> = rs.iter().filter(|r| !r["from"].as_array().is_some_and(Vec::is_empty)).map(|r| &r["to"]).collect();
|
||||
let filled: Vec<&Value> = rs.iter().filter(|r| !empty(r)).map(|r| &r["to"]).collect();
|
||||
let assign = d.fields.get("__assign").and_then(Value::as_array).filter(|_| d.bool("__art"));
|
||||
let rest = assign.map_or(&[][..], |a| a.get(filled.len()..).unwrap_or_default());
|
||||
let colors: Vec<&Value> = filled.into_iter().chain(rest).collect();
|
||||
@@ -787,7 +801,7 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
|
||||
sync_theme(app, &mut d);
|
||||
sync_weights(app, &mut d);
|
||||
if d.bool("__newGroup") {
|
||||
let colors = group_colors(app, &d, rows(&d).iter().filter(|r| !excluded(r)));
|
||||
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, CMD, apply_params(&d))?;
|
||||
@@ -1000,7 +1014,8 @@ fn assign_tab(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog, rows: &mut
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| mode_menu(ui, d, &target, false));
|
||||
});
|
||||
ui.add_space(6.0);
|
||||
changed |= sliders(app, ui, d, rows);
|
||||
let row = first_selected(d, rows);
|
||||
changed |= sliders(app, ui, d, rows, row);
|
||||
ui.add_space(8.0);
|
||||
egui::Grid::new("recolor-options").num_columns(2).spacing([10.0, 8.0]).show(ui, |ui| {
|
||||
ui.label(egui::RichText::new(tl!("Method:")).color(t.text_dim));
|
||||
@@ -1131,8 +1146,13 @@ fn slider_values(d: &Dialog, rows: &[Value], i: usize, c: &Color, mode: Mode) ->
|
||||
v.filter(|v| v.len() == mode.labels().len()).unwrap_or_else(|| components(mode, c))
|
||||
}
|
||||
|
||||
/// What the color sliders edit: the first selected row, its new color, and the name of the
|
||||
/// library's spot color that color is.
|
||||
/// The first selected row of `rows`.
|
||||
fn first_selected(d: &Dialog, rows: &[Value]) -> Option<usize> {
|
||||
selection(d).into_iter().filter(|i| *i < rows.len()).min()
|
||||
}
|
||||
|
||||
/// What the color sliders edit: a row (the first selected row on the Assign tab, the base color's
|
||||
/// row on the Edit tab), its new color, and the name of the library's spot color that color is.
|
||||
struct SliderTarget {
|
||||
row: Option<usize>,
|
||||
color: Option<Color>,
|
||||
@@ -1141,7 +1161,12 @@ struct SliderTarget {
|
||||
|
||||
impl SliderTarget {
|
||||
fn of(app: &VectorcraftApp, d: &Dialog, rows: &[Value]) -> Self {
|
||||
let row = selection(d).into_iter().filter(|i| *i < rows.len()).min();
|
||||
Self::at(app, d, rows, first_selected(d, rows))
|
||||
}
|
||||
|
||||
/// What the color sliders edit when they edit row `row`.
|
||||
fn at(app: &VectorcraftApp, d: &Dialog, rows: &[Value], row: Option<usize>) -> Self {
|
||||
let row = row.filter(|i| *i < rows.len());
|
||||
let color = row.and_then(|i| to_color(&rows[i]));
|
||||
// A row tint acts only on art, so without art a spot color shows the process modes.
|
||||
let spot = color.filter(|_| d.bool("__art")).and_then(|c| spot_of(app, d, &c));
|
||||
@@ -1252,11 +1277,11 @@ fn slider_cell(
|
||||
dragged.map(|x| (lo + f64::from(x) * (hi - lo)).round()).or(keyed).or(typed).map(|v| v.clamp(lo, hi)).filter(|v| (v - value).abs() > 1e-6)
|
||||
}
|
||||
|
||||
/// The color sliders under the rows, two to a line: they edit the first selected row's new color
|
||||
/// (the others keep theirs) in the mode of [`mode_menu`], or its tint of a spot color of the
|
||||
/// library. Without a selected row they are disabled. Returns true when they changed a row.
|
||||
fn sliders(app: &VectorcraftApp, ui: &mut Ui, d: &mut Dialog, rows: &mut [Value]) -> bool {
|
||||
let target = SliderTarget::of(app, d, rows);
|
||||
/// The color sliders, two to a line: they edit row `row`'s new color (the others keep theirs) in
|
||||
/// the mode of [`mode_menu`], or its tint of a spot color of the library. Without a row they are
|
||||
/// disabled. Returns true when they changed a row.
|
||||
fn sliders(app: &VectorcraftApp, ui: &mut Ui, d: &mut Dialog, rows: &mut [Value], row: Option<usize>) -> bool {
|
||||
let target = SliderTarget::at(app, d, rows, row);
|
||||
let mode = target.mode(d);
|
||||
let mut changed = false;
|
||||
let top = ui.cursor().top();
|
||||
@@ -1357,9 +1382,17 @@ fn new_row(rows: &mut Vec<Value>, sel: &[usize]) -> usize {
|
||||
at
|
||||
}
|
||||
|
||||
/// The rows the Edit tab shows: those with a new colour, not excluded.
|
||||
/// The rows the Edit tab shows, the harmony rules fill and the Color Theme Picker recolors: those
|
||||
/// with a new colour that aren't excluded and hold current colors.
|
||||
fn active_rows(rows: &[Value]) -> Vec<usize> {
|
||||
(0..rows.len()).filter(|i| !excluded(&rows[*i]) && to_color(&rows[*i]).is_some()).collect()
|
||||
(0..rows.len()).filter(|i| in_group(&rows[*i]) && to_color(&rows[*i]).is_some()).collect()
|
||||
}
|
||||
|
||||
/// The row the Edit tab's color sliders edit: the first selected row when the tab shows it (one of
|
||||
/// `active`), else the base color's row `base`. A selected row the tab does not show (excluded, or
|
||||
/// empty) is left as it is.
|
||||
fn edit_slider_row(d: &Dialog, rows: &[Value], active: &[usize], base: Option<usize>) -> Option<usize> {
|
||||
first_selected(d, rows).filter(|i| active.contains(i)).or(base)
|
||||
}
|
||||
|
||||
/// Set row `i`'s new colour to hue/saturation/brightness `hsb` ([`move_on_wheel`]: with `linked`
|
||||
@@ -1388,7 +1421,8 @@ fn edit_tab(app: &VectorcraftApp, ui: &mut Ui, d: &mut Dialog, rows: &mut [Value
|
||||
let linked = d.bool("linked");
|
||||
let active = active_rows(rows);
|
||||
let base = selection(d).into_iter().find(|i| active.contains(i)).or(active.first().copied());
|
||||
let target = SliderTarget::of(app, d, rows);
|
||||
let slider_row = edit_slider_row(d, rows, &active, base);
|
||||
let target = SliderTarget::at(app, d, rows, slider_row);
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(egui::RichText::new(tl!("Harmony Rules:")).color(t.text_dim));
|
||||
let rule = Harmony::parse(&d.str("rule")).unwrap_or(Harmony::Complementary);
|
||||
@@ -1411,7 +1445,7 @@ fn edit_tab(app: &VectorcraftApp, ui: &mut Ui, d: &mut Dialog, rows: &mut [Value
|
||||
let button = widgets::icon_button(ui, "dc-folder", tl!("New Color Group"), false, 24.0);
|
||||
let prominent = d.bool("__art") && !prominent_parts(d, rows).is_empty();
|
||||
let saved = egui::Popup::menu(&button).show(|ui| {
|
||||
if widgets::menu_item_name(ui, tl!("Save All Colors"), rows.iter().any(|r| !excluded(r)), false) {
|
||||
if widgets::menu_item_name(ui, tl!("Save All Colors"), rows.iter().any(in_group), false) {
|
||||
return Some("all");
|
||||
}
|
||||
widgets::menu_item_name(ui, tl!("Save Prominent Colors"), prominent, false).then_some("prominent")
|
||||
@@ -1489,7 +1523,7 @@ fn edit_tab(app: &VectorcraftApp, ui: &mut Ui, d: &mut Dialog, rows: &mut [Value
|
||||
let sample = base.and_then(|b| to_color(&rows[b])).unwrap_or(Color::rgb(0.8, 0.45, 0.25));
|
||||
global_sliders(ui, d, sample);
|
||||
} else {
|
||||
changed |= sliders(app, ui, d, rows);
|
||||
changed |= sliders(app, ui, d, rows, slider_row);
|
||||
}
|
||||
// The new colours: click one to make it the base colour.
|
||||
let min_height = (TAB_H - (ui.cursor().top() - top)).max(0.0);
|
||||
@@ -1708,6 +1742,27 @@ mod tests {
|
||||
assert_eq!(p["groupColors"], json!(["rgb 255 0 0", "rgb 0 0 255", "rgb 0 255 0", "rgb 9 9 9"]));
|
||||
}
|
||||
|
||||
/// Opened on colors alone, OK saves the new colors of the rows that hold current colors as the
|
||||
/// new color group, in row order: an empty row gives it no color.
|
||||
#[test]
|
||||
fn an_empty_row_gives_a_new_group_no_color() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 100, "height": 100})).unwrap();
|
||||
app.run("ui.recolorDialog", json!({"colors": ["#ff8000", "#0080ff"]})).unwrap();
|
||||
let d = app.ui.dialog.as_mut().unwrap();
|
||||
let mut rs = super::rows(d);
|
||||
let at = new_row(&mut rs, &[1]);
|
||||
rs[at]["to"] = json!("rgb 255 0 255");
|
||||
d.fields.insert("rows".into(), Value::Array(rs));
|
||||
let d = d.clone();
|
||||
let groups = app.session.doc().unwrap().doc.swatch_groups.len();
|
||||
confirm(&mut app, &d).unwrap();
|
||||
let doc = &app.session.doc().unwrap().doc;
|
||||
assert_eq!(doc.swatch_groups.len(), groups + 1, "a new color group");
|
||||
let colors: Vec<String> = doc.swatch_groups.last().unwrap().swatches.iter().map(|w| w.paint.color().unwrap().to_hex()).collect();
|
||||
assert_eq!(colors, ["#ff8000", "#0080ff"]);
|
||||
}
|
||||
|
||||
/// Randomize after a seed past `u64::MAX` keeps the largest seed.
|
||||
#[test]
|
||||
fn next_seed_holds_at_the_largest() {
|
||||
@@ -1740,6 +1795,27 @@ mod tests {
|
||||
assert_eq!([&r[0]["to"], &r[1]["to"], &r[2]["to"]], ["rgb 255 0 0", "rgb 0 255 0", "rgb 0 0 255"]);
|
||||
}
|
||||
|
||||
/// A row made with New Row is not on the Edit tab while it is empty: a harmony rule gives it
|
||||
/// no color and a linked move leaves its new color as it is.
|
||||
#[test]
|
||||
fn an_empty_row_takes_no_harmony_or_wheel_color() {
|
||||
let mut r = rows();
|
||||
new_row(&mut r, &[]);
|
||||
assert_eq!(r[0]["to"], "rgb 255 0 0");
|
||||
let active = active_rows(&r);
|
||||
assert_eq!(active, [1, 2, 3]);
|
||||
apply_rule(&mut r, Harmony::Triad, 1, Color::rgb(1.0, 0.0, 0.0), &active);
|
||||
assert_eq!([&r[0]["to"], &r[1]["to"], &r[2]["to"], &r[3]["to"]], ["rgb 255 0 0", "rgb 255 0 0", "rgb 0 255 0", "rgb 0 0 255"]);
|
||||
move_color(&mut r, 1, [120.0, 1.0, 1.0], true);
|
||||
assert_eq!(r[1]["to"], "rgb 0 255 0");
|
||||
assert_eq!(r[0]["to"], "rgb 255 0 0", "the empty row keeps its new color");
|
||||
// With the empty row selected, the sliders edit the base color's row instead.
|
||||
let sel = |s: Value| Dialog::new("recolor", json!({"__sel": s}));
|
||||
assert_eq!(edit_slider_row(&sel(json!([0])), &r, &active, Some(1)), Some(1));
|
||||
assert_eq!(edit_slider_row(&sel(json!([3, 2])), &r, &active, Some(3)), Some(2), "a shown row: the first selected");
|
||||
assert_eq!(edit_slider_row(&sel(json!([0])), &r, &[], None), None, "no row to edit");
|
||||
}
|
||||
|
||||
/// A rule or a wheel move that gives a row a new color drops the row's tint; a row whose
|
||||
/// color stays keeps it.
|
||||
#[test]
|
||||
@@ -1993,6 +2069,23 @@ mod tests {
|
||||
assert_eq!(app.session.doc().unwrap().history.undo.len(), undo, "the art is unchanged: no undo step");
|
||||
}
|
||||
|
||||
/// The Color Theme Picker gives its colors only to the rows that hold current colors: a row
|
||||
/// made with New Row keeps its new color and takes no place in the palette.
|
||||
#[test]
|
||||
fn theme_picks_leave_an_empty_row_out() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
let ctx = egui::Context::default();
|
||||
theme_setup(&mut app, &ctx);
|
||||
let d = app.ui.dialog.as_mut().unwrap();
|
||||
let mut rs = super::rows(d);
|
||||
let at = new_row(&mut rs, &[]);
|
||||
rs[at]["to"] = json!("rgb 9 9 9");
|
||||
d.fields.insert("rows".into(), Value::Array(rs));
|
||||
d.fields.insert(THEME_PICKS.into(), json!([{"at": [107, 17]}, {"rect": [125, 5, 150, 30]}]));
|
||||
frame(&mut app, &ctx, 0.1, vec![], 0);
|
||||
assert_eq!(new_colors(&app), [json!("rgb 9 9 9"), json!("rgb 0 255 0"), json!("rgb 255 255 0")]);
|
||||
}
|
||||
|
||||
/// A row made with New Row recolors nothing while it is empty, and OK keeps it; the blue art's
|
||||
/// color merged into it takes its new color, in the preview and at OK.
|
||||
#[test]
|
||||
@@ -2163,6 +2256,33 @@ mod tests {
|
||||
assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 2, "a step for each group");
|
||||
}
|
||||
|
||||
/// Save All Colors leaves out a row made with New Row while it is empty; with only empty rows
|
||||
/// it saves no group and records no step.
|
||||
#[test]
|
||||
fn save_all_colors_leaves_an_empty_row_out() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
let ctx = egui::Context::default();
|
||||
prominent_setup(&mut app, &ctx);
|
||||
let groups = |app: &VectorcraftApp| app.session.doc().unwrap().doc.swatch_groups.len();
|
||||
let (n, undo) = (groups(&app), app.session.doc().unwrap().history.undo.len());
|
||||
let save = |app: &mut VectorcraftApp, rows: Value, t: f64| {
|
||||
let d = app.ui.dialog.as_mut().unwrap();
|
||||
d.fields.insert("rows".into(), rows);
|
||||
d.fields.insert(SAVE_GROUP.into(), json!("all"));
|
||||
frame(app, &ctx, t, vec![], 0);
|
||||
frame(app, &ctx, t + 0.01, vec![], 0);
|
||||
};
|
||||
let blank = json!({"from": [], "to": "rgb 255 0 255"});
|
||||
save(&mut app, json!([blank, {"from": [BLUE], "to": "rgb 255 255 0"}, {"from": [RED, PURPLE], "to": "rgb 0 255 0"}]), 0.1);
|
||||
let doc = &app.session.doc().unwrap().doc;
|
||||
let colors: Vec<String> = doc.swatch_groups.last().unwrap().swatches.iter().map(|w| w.paint.color().unwrap().to_hex()).collect();
|
||||
assert_eq!(colors, ["#ffff00", "#00ff00"]);
|
||||
assert_eq!(groups(&app), n + 1);
|
||||
save(&mut app, json!([blank, {"from": [BLUE, RED, PURPLE], "to": "rgb 0 255 0", "exclude": true}]), 0.2);
|
||||
assert_eq!(groups(&app), n + 1, "only an empty and an excluded row: no group");
|
||||
assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 1, "and no step");
|
||||
}
|
||||
|
||||
/// One frame with `modifiers` held.
|
||||
fn frame_with(app: &mut VectorcraftApp, ctx: &egui::Context, time: f64, events: Vec<egui::Event>, modifiers: egui::Modifiers) {
|
||||
let events = std::iter::once(egui::Event::ModifiersChanged(modifiers)).chain(events).collect();
|
||||
|
||||
+6
-3
@@ -4575,7 +4575,10 @@ the others turn by the same hue). `limitTo` snaps new colours to a swatch librar
|
||||
new color as it is and shuffles only the rows that hold current colors. A row without `from`, or with
|
||||
a current color that is not a color, is refused. With art selected, the Recolor Artwork dialog's New Row button (beside
|
||||
Merge) adds such a row above the first selected row, or at the top, with that row's new color, and selects it; Shift-click a row below it and Merge to move that row's colors into it (Merge keeps the topmost selected row's new color). An
|
||||
empty row does not count toward Colors. With `limitTo`, a row's `tint` (a percentage, default 100) gives the art
|
||||
empty row does not count toward Colors. While it is empty, the dialog's Edit tab does not show it (its sliders edit
|
||||
the base color when the empty row is selected), the harmony rules,
|
||||
linked moves and the Color Theme Picker leave its new color as it is, and Save All Colors and a new color group saved
|
||||
from colors alone leave its new color out. With `limitTo`, a row's `tint` (a percentage, default 100) gives the art
|
||||
linked to the global or spot swatch its new color is that share of its tint; `tint` must be a number. `recolor.randomize`
|
||||
moves a row's `tint` with its new color and removes it from a color it changes, and moves a row's `model` with its new color. `swatch.editGroup {group, colors, rename?}` rewrites a colour group in one undo
|
||||
step (art linked to its global swatches follows), and `recolor.apply` with `group` recolours the art and rewrites the
|
||||
@@ -4617,7 +4620,7 @@ objects are read. As VectorCraft's own rule, each object read weighs the same, s
|
||||
among its pixels; the vector art a symbol instance places counts as one object, and each image it places counts on
|
||||
its own), and similar colors merge (k-means in Lab) into at most `colors` (1 to 64, default 5), each shown by its
|
||||
most used color in its own model. Picks that touch no art return no colors. In the Recolor Artwork dialog the picks are the `themePicks` field: the rows that aren't
|
||||
excluded take the palette as their new colors in row order, the colors repeating when the rows outnumber them.
|
||||
excluded and hold current colors take the palette as their new colors in row order, the colors repeating when the rows outnumber them.
|
||||
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"recolor.pickTheme","params":{"picks":[{"at":[120,80]},{"rect":[200,40,320,140]}],"colors":4}}}
|
||||
@@ -4643,7 +4646,7 @@ bar sits under the Edit tab's wheel: each row with a share is a part as wide as
|
||||
the largest first. Dragging the edge between two parts moves width between them, and when the drag ends the widths
|
||||
become the `weights` field, which moves the rows' current colors and previews the result. The New Color Group menu
|
||||
beside the link button runs `swatch.newGroup` right away, as its own undo step: Save All Colors saves the new colors
|
||||
of the rows that are not excluded, in row order, and Save Prominent Colors saves the bar's colors in the bar's order.
|
||||
of the rows that are not excluded and hold current colors, in row order, and Save Prominent Colors saves the bar's colors in the bar's order.
|
||||
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"recolor.weigh","params":{"map":[{"from":["rgb 255 0 0","rgb 128 0 204"],"to":"#00ff00"},{"from":["rgb 0 0 255"],"to":"#ffff00"}],"weights":[1,1]}}}
|
||||
|
||||
@@ -1658,7 +1658,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- **Recolor Artwork layout (#3416):** the Edit chip list uses the modal scroll helper and its actual remaining height; the tab's minimum-height space scrolls with the chips. `tests_recolor` covers 5/20/200/400 colors, window resizing, 100/125/150/200% UI scaling, scrolling to and editing the final chip, Preview, Cancel, Confirm and Undo, alongside the existing #1733 drag regressions. Scores and estimates unchanged.
|
||||
- **Recolor Artwork Edit displays:** buttons beside the Edit tab's wheel show the colors on a smooth color wheel, a segmented color wheel or as color bars ([Edit colors using Recolor Artwork](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/edit-colors-using-edit-colors-dialog.html)). The segmented wheel draws 24 hues by 5 saturations as solid patches, and its markers move freely as on the smooth wheel. The bars show one solid bar per recolored color in row order: a click selects a bar for the color sliders, and a drag moves its row without changing a color ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html)). The dialog opens on the smooth wheel; `display` (`smooth`, `segmented`, `bars`) is the dialog field. `tests_recolor` covers switching, the dialog height, segmented dragging and Brightness, and bar selection, editing, reordering, scrolling, Preview, Cancel and OK. 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. Tests: `a_new_row_goes_above_the_selection_and_takes_merged_colors`, `an_empty_row_gives_the_group_no_color` 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 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`.
|
||||
- **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.
|
||||
|
||||
Reference in New Issue
Block a user