From 54e8d3046e2d84e2a3508615be66b1c7c52eb2f9 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 12:16:05 -0800 Subject: [PATCH] Save for Web: Delete Color removes colors from the color table The color table's trash button and Delete Color in its new menu delete the selected GIF or PNG-8 colors. Pixels that used a deleted color take the nearest color left, with the current reduction's color distance and dither, and the preview matches the saved file. A click selects one color and makes it the anchor, Shift-click selects the range from the anchor, and Ctrl-click (Command-click on macOS) adds or removes one. - colorTable.deleted lists the deleted colors by source. A deleted color leaves the locked, transparent and webShift lists. - colorTable.customPalette fixes the palette at the first deletion, so a deleted color is not made again; the table reads Custom. Restore Generated Table in the menu, or another reduction, clears both. - Deleting every opaque color, or every color not mapped to transparent, is an error and changes nothing. - Presets and the remembered settings keep the edit. - quantize_to uses all 256 fixed colors when no pixel is transparent. Docs: docs/mcp.md, docs/target-app-parity.md. --- crates/engine/src/cmd/webexport.rs | 95 +++++++-- crates/engine/src/tests/webexport.rs | 86 ++++++++ crates/render/src/encode/quantize.rs | 7 +- crates/render/src/encode/tests_palette.rs | 11 +- crates/ui-egui/src/dialogs.rs | 4 +- crates/ui-egui/src/dialogs/save_for_web.rs | 188 ++++++++++++++++-- .../ui-egui/src/dialogs/tests_save_for_web.rs | 135 +++++++++++++ crates/ui-egui/src/i18n/bg.tsv | 3 + crates/ui-egui/src/i18n/bs.tsv | 3 + crates/ui-egui/src/i18n/ca.tsv | 3 + crates/ui-egui/src/i18n/cs.tsv | 3 + crates/ui-egui/src/i18n/da.tsv | 3 + crates/ui-egui/src/i18n/de.tsv | 3 + crates/ui-egui/src/i18n/el.tsv | 3 + crates/ui-egui/src/i18n/es.tsv | 3 + crates/ui-egui/src/i18n/fi.tsv | 3 + crates/ui-egui/src/i18n/fr.tsv | 3 + crates/ui-egui/src/i18n/gu.tsv | 2 + crates/ui-egui/src/i18n/hi.tsv | 3 + crates/ui-egui/src/i18n/hu.tsv | 3 + crates/ui-egui/src/i18n/id.tsv | 3 + crates/ui-egui/src/i18n/it.tsv | 3 + crates/ui-egui/src/i18n/ja.tsv | 3 + crates/ui-egui/src/i18n/ka.tsv | 3 + crates/ui-egui/src/i18n/ko.tsv | 3 + crates/ui-egui/src/i18n/nl.tsv | 3 + crates/ui-egui/src/i18n/pl.tsv | 3 + crates/ui-egui/src/i18n/pt-br.tsv | 3 + crates/ui-egui/src/i18n/ru.tsv | 3 + crates/ui-egui/src/i18n/sv.tsv | 3 + crates/ui-egui/src/i18n/tr.tsv | 3 + crates/ui-egui/src/i18n/uk.tsv | 3 + crates/ui-egui/src/i18n/vi.tsv | 3 + crates/ui-egui/src/i18n/zh-hans.tsv | 3 + crates/ui-egui/src/i18n/zh-hant.tsv | 3 + docs/mcp.md | 21 +- docs/target-app-parity.md | 1 + 37 files changed, 593 insertions(+), 38 deletions(-) diff --git a/crates/engine/src/cmd/webexport.rs b/crates/engine/src/cmd/webexport.rs index c6764cddb4..897cd87c55 100644 --- a/crates/engine/src/cmd/webexport.rs +++ b/crates/engine/src/cmd/webexport.rs @@ -32,7 +32,7 @@ pub fn specs() -> Vec { "Save for Web", [], None, - "{path?, preset?: a webExport.presets name (its settings, then these keys), format?: gif (default)|jpg|png8|png24, reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray (gif/png8, as the next five), colors?: 128 (2–256), dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, webSnap?: 0 (0–100 %: colours that close to a web-safe one become it), lossy?: 0 (0–100, gif), colorTable?: {locked?: [\"#rrggbb\"…] (kept when reducing), transparent?: [\"#rrggbb\"…] (become transparent), webShift?: [\"#rrggbb\"…] (become web-safe), sort?: none|hue|luminance|popularity} (colours as the preview's colors[].source; #rrggbbaa and #rgba are refused here and in matte), transparency?: true (gif/png8/png24), matte?: white (default)|black|none|\"#rrggbb\" (what edges blend into; jpg and opaque png24: the background), interlaced?: false (gif/png8/png24), quality?: 60 (jpg: 0–100), progressive?: false (jpg), optimized?: true (jpg), embedProfile?: false (jpg: sRGB profile), width?: px | height?: px | percent?: 100 (the image size, proportional; width wins over height, height over percent), antiAlias?: none|art (default)|type, clipToArtboard?: true (the artboard; false: the art and the slices), artboard?: 0 (0-based), convertToSrgb?: true (PNG files say they are sRGB), metadata?: none|copyright (default)|contact|all (File Info written as PNG text, a GIF or JPEG comment), slices?: all (default)|selected|none (one image per slice: images/.), output?: images (default)|html (an HTML page placing the image or slices, .html)} → {path, files: [path…], bytes (total), width, height, warnings: [] or [a note that an image couldn't be decoded and is missing from the image]}; no path → {files: [{name, dataBase64}], bytes, width, height, warnings} (names such as page.html, images/page_01.gif). A single image without HTML is written at path itself", + "{path?, preset?: a webExport.presets name (its settings, then these keys), format?: gif (default)|jpg|png8|png24, reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray (gif/png8, as the next five), colors?: 128 (2–256), dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, webSnap?: 0 (0–100 %: colours that close to a web-safe one become it), lossy?: 0 (0–100, gif), colorTable?: {locked?: [\"#rrggbb\"…] (kept when reducing), transparent?: [\"#rrggbb\"…] (become transparent), webShift?: [\"#rrggbb\"…] (become web-safe), sort?: none|hue|luminance|popularity, deleted?: [\"#rrggbb\"…] (taken out of the table: their pixels take the nearest color left, and at least one color stays), customPalette?: [\"#rrggbb\"…] (a fixed palette used instead of the reduction's, at most `colors` entries; a new reduction without colorTable clears it and deleted)} (colours as the preview's colors[].source; #rrggbbaa and #rgba are refused here and in matte), transparency?: true (gif/png8/png24), matte?: white (default)|black|none|\"#rrggbb\" (what edges blend into; jpg and opaque png24: the background), interlaced?: false (gif/png8/png24), quality?: 60 (jpg: 0–100), progressive?: false (jpg), optimized?: true (jpg), embedProfile?: false (jpg: sRGB profile), width?: px | height?: px | percent?: 100 (the image size, proportional; width wins over height, height over percent), antiAlias?: none|art (default)|type, clipToArtboard?: true (the artboard; false: the art and the slices), artboard?: 0 (0-based), convertToSrgb?: true (PNG files say they are sRGB), metadata?: none|copyright (default)|contact|all (File Info written as PNG text, a GIF or JPEG comment), slices?: all (default)|selected|none (one image per slice: images/.), output?: images (default)|html (an HTML page placing the image or slices, .html)} → {path, files: [path…], bytes (total), width, height, warnings: [] or [a note that an image couldn't be decoded and is missing from the image]}; no path → {files: [{name, dataBase64}], bytes, width, height, warnings} (names such as page.html, images/page_01.gif). A single image without HTML is written at path itself", has_doc, export ), @@ -325,27 +325,39 @@ pub struct ColorTable { pub web_shift: Vec, #[serde(serialize_with = "ser_key", deserialize_with = "de_key")] pub sort: ColorSort, + /// Taken out of the table: their pixels take the nearest color left. A deleted color is no + /// longer locked, transparent or web-shifted. + pub deleted: Vec, + /// A fixed palette (a Custom table) used instead of the reduction's own: the colors of the + /// table when the first color was deleted. Empty: the reduction makes the palette. + pub custom_palette: Vec, } /// The most colours a colour table list holds. const MAX_TABLE: usize = 256; +/// The error for a deletion that would leave the color table no color for the pixels. +pub const KEEP_ONE: &str = "colorTable.deleted: at least one color has to stay in the color table"; + impl ColorTable { + /// Whether the table is a Custom one: a color was deleted or the palette is fixed. + pub fn is_custom(&self) -> bool { + !self.deleted.is_empty() || !self.custom_palette.is_empty() + } + fn colors(list: &[String], what: &str) -> std::result::Result, String> { if list.len() > MAX_TABLE { return Err(format!("colorTable.{what}: at most {MAX_TABLE} colours")); } - list.iter() - .map(|h| { - vectorcraft_color::Color::from_hex(h) - .filter(|_| !super::hex_with_alpha(h)) - .map(|c| { - let [r, g, b, _] = c.to_rgba8(1.0); - [r, g, b] - }) - .ok_or_else(|| format!("colorTable.{what}: `{h}` is not a colour such as \"#ff8800\"")) - }) - .collect() + list.iter().map(|h| Self::rgb(h).ok_or_else(|| format!("colorTable.{what}: `{h}` is not a colour such as \"#ff8800\""))).collect() + } + + /// `h` as RGB; `None` when it is not a color such as `#ff8800`. + fn rgb(h: &str) -> Option<[u8; 3]> { + vectorcraft_color::Color::from_hex(h).filter(|_| !super::hex_with_alpha(h)).map(|c| { + let [r, g, b, _] = c.to_rgba8(1.0); + [r, g, b] + }) } } @@ -445,7 +457,13 @@ impl WebSettings { } } } - let s: WebSettings = serde_json::from_value(v).map_err(|e| format!("Save for Web settings: {e}"))?; + let mut s: WebSettings = serde_json::from_value(v).map_err(|e| format!("Save for Web settings: {e}"))?; + // Another reduction makes a new palette: the deletions and the fixed palette go, unless + // the params give the color table too. + if p.get("reduction").is_some() && p.get("colorTable").is_none() && s.reduction != self.reduction { + s.color_table.deleted.clear(); + s.color_table.custom_palette.clear(); + } s.checked() } @@ -463,11 +481,19 @@ impl WebSettings { return Err("width and height are at least 1 pixel".into()); } self.matte_rgb()?; + let table = &mut self.color_table; for (list, what) in - [(&self.color_table.locked, "locked"), (&self.color_table.transparent, "transparent"), (&self.color_table.web_shift, "webShift")] + [(&table.locked, "locked"), (&table.transparent, "transparent"), (&table.web_shift, "webShift"), (&table.custom_palette, "customPalette")] { ColorTable::colors(list, what)?; } + // A deleted color is no longer locked, transparent or web-shifted. + let deleted = ColorTable::colors(&table.deleted, "deleted")?; + if !deleted.is_empty() { + for list in [&mut table.locked, &mut table.transparent, &mut table.web_shift] { + list.retain(|h| ColorTable::rgb(h).is_none_or(|c| !deleted.contains(&c))); + } + } Ok(self) } @@ -741,7 +767,7 @@ fn palette_image(rgba: &[u8], w: u32, h: u32, s: &WebSettings, matte: Option<[u8 transparency: s.transparency, matte, }; - let mut ix = quantize::quantize_locked(rgba, w, h, &o, &locked); + let mut ix = reduced(rgba, w, h, s, &o, &locked)?; // Map to transparent works on the colours the reduction made. let before = ix.palette.clone(); let clear = ix.transparent.map(usize::from); @@ -789,6 +815,45 @@ fn palette_image(rgba: &[u8], w: u32, h: u32, s: &WebSettings, matte: Option<[u8 Ok(PaletteImage { ix, colors, mapped }) } +/// The pixels reduced to the palette `s` gives: the reduction's own (`locked` kept), or the +/// color table's fixed one, without the deleted colors. The pixels of a deleted color take the +/// nearest color left, with `o`'s dither. A deletion has to leave a color that is not mapped to +/// transparent. +fn reduced(rgba: &[u8], w: u32, h: u32, s: &WebSettings, o: &PaletteOptions, locked: &[[u8; 3]]) -> std::result::Result { + let table = &s.color_table; + let deleted = ColorTable::colors(&table.deleted, "deleted")?; + let custom = ColorTable::colors(&table.custom_palette, "customPalette")?; + let to_clear = ColorTable::colors(&table.transparent, "transparent")?; + let opaque_left = |left: &[[u8; 3]]| left.iter().any(|c| !to_clear.contains(c)); + if custom.is_empty() { + let ix = quantize::quantize_locked(rgba, w, h, o, locked); + let clear = ix.transparent.map(usize::from); + let gone = |i: usize, c: &[u8; 3]| Some(i) != clear && deleted.contains(c); + if !ix.palette.iter().enumerate().any(|(i, c)| gone(i, c)) { + return Ok(ix); + } + let left: Vec<[u8; 3]> = ix.palette.iter().enumerate().filter(|&(i, c)| Some(i) != clear && !deleted.contains(c)).map(|(_, c)| *c).collect(); + if left.is_empty() || !opaque_left(&left) { + return Err(KEEP_ONE.into()); + } + return Ok(quantize::quantize_to(rgba, w, h, o, &left)); + } + // A fixed palette holds at most `colors` entries, the transparent one included. + let has_clear = s.transparency && rgba.as_chunks::<4>().0.iter().any(|p| p[3] < 128); + let removed = custom.iter().any(|c| deleted.contains(c)); + let mut left: Vec<[u8; 3]> = vec![]; + for c in custom { + if !deleted.contains(&c) && !left.contains(&c) { + left.push(c); + } + } + left.truncate(usize::from(s.colors.clamp(2, 256)) - usize::from(has_clear)); + if left.is_empty() || (removed && !opaque_left(&left)) { + return Err(KEEP_ONE.into()); + } + Ok(quantize::quantize_to(rgba, w, h, o, &left)) +} + /// An optimised image as straight RGBA → `(pixels, width, height)` (the dialog's preview). pub fn decode(o: &Optimized) -> std::result::Result<(Vec, u32, u32), String> { let img = craft_image_codecs::decode(o.display()).map_err(|e| format!("the optimised image can't be read back: {e}"))?; diff --git a/crates/engine/src/tests/webexport.rs b/crates/engine/src/tests/webexport.rs index a731e51aca..21ae0796d3 100644 --- a/crates/engine/src/tests/webexport.rs +++ b/crates/engine/src/tests/webexport.rs @@ -453,6 +453,92 @@ fn colour_table_lock_web_shift_snap_and_sort() { assert!(lossy < plain, "{lossy} vs {plain}"); } +/// Delete Color: the deleted colors leave the table and the file, their pixels take the nearest +/// color left, and the edit stays with the settings until another reduction is chosen. +#[test] +fn colour_table_delete_maps_pixels_to_the_nearest_color_left() { + // 40×10: red, a near red and blue, and 10 px with nothing (transparent). + let mut s = session(40.0, 10.0); + rect(&mut s, [0.0, 0.0, 10.0, 10.0], "#ff0000"); + rect(&mut s, [10.0, 0.0, 10.0, 10.0], "#ee1100"); + rect(&mut s, [20.0, 0.0, 10.0, 10.0], "#0000ff"); + let preview = |s: &mut Session, p: Value| run(s, "document.exportForWeb.preview", p); + let sources = |v: &Value| -> Vec { + let mut out: Vec = + v["colors"].as_array().unwrap().iter().filter(|c| c["transparent"] == false).map(|c| c["source"].as_str().unwrap().to_string()).collect(); + out.sort(); + out + }; + let base = preview(&mut s, json!({"dither": "none"})); + assert_eq!(base["colors"].as_array().unwrap().len(), 4, "{base}"); + for format in ["gif", "png8"] { + let p = json!({"format": format, "dither": "none", "colorTable": {"deleted": ["#EE1100"]}}); + let v = preview(&mut s, p.clone()); + assert_eq!(v["colors"].as_array().unwrap().len(), 3, "{format}: {v}"); + assert!(v["colors"].as_array().unwrap().iter().any(|c| c["transparent"] == true), "{format}: the transparent entry stays"); + assert_eq!(sources(&v), ["#0000ff", "#ff0000"], "{format}"); + let file = one(&mut s, p); + assert_eq!(v["bytes"].as_u64(), Some(file.len() as u64), "{format}: the preview is the file"); + let img = pixels(&file); + assert_eq!(img.get_pixel(15, 5).0, [255, 0, 0, 255], "{format}: the nearest color left"); + assert_eq!((img.get_pixel(5, 5).0, img.get_pixel(25, 5).0, img.get_pixel(35, 5).0[3]), ([255, 0, 0, 255], [0, 0, 255, 255], 0)); + assert_eq!(distinct(&img), 3, "{format}"); + } + // A color the table does not hold is no edit; sorting does not bring a deleted one back. + assert_eq!(sources(&preview(&mut s, json!({"dither": "none", "colorTable": {"deleted": ["#123456"]}}))).len(), 3); + let sorted = preview(&mut s, json!({"dither": "none", "colorTable": {"deleted": ["#ee1100"], "sort": "luminance"}})); + assert_eq!(sources(&sorted), ["#0000ff", "#ff0000"]); + // A fixed palette: colors it lacks are not made again, and deletions come out of it. + let fixed = preview(&mut s, json!({"dither": "none", "colorTable": {"customPalette": ["#0000ff", "#ff0000"]}})); + assert_eq!(sources(&fixed), ["#0000ff", "#ff0000"]); + let fixed = preview(&mut s, json!({"dither": "none", "colorTable": {"customPalette": ["#0000ff", "#ff0000"], "deleted": ["#ff0000"]}})); + assert_eq!(sources(&fixed), ["#0000ff"]); + // At most `colors` entries of a fixed palette, the transparent one included. + let two = preview(&mut s, json!({"dither": "none", "colors": 2, "colorTable": {"customPalette": ["#0000ff", "#ff0000"]}})); + assert_eq!(sources(&two), ["#0000ff"]); + // Deleting every opaque color is refused: the pixels need a color. + // Colors mapped to transparent do not count as left. + for table in [ + json!({"deleted": ["#ff0000", "#ee1100", "#0000ff"]}), + json!({"customPalette": ["#ff0000"], "deleted": ["#ff0000"]}), + json!({"deleted": ["#0000ff", "#ee1100"], "transparent": ["#ff0000"]}), + json!({"customPalette": ["#ff0000", "#0000ff"], "deleted": ["#0000ff"], "transparent": ["#ff0000"]}), + ] { + let p = json!({"colorTable": table}); + let e = s.execute("document.exportForWeb.preview", &p).err().map(|e| e.to_string()).unwrap_or_default(); + assert!(e.contains(cmd::webexport::KEEP_ONE), "{p}: {e}"); + assert!(s.execute("document.exportForWeb", &p).is_err(), "{p}"); + } + for bad in [ + json!({"colorTable": {"deleted": ["nope"]}}), + json!({"colorTable": {"customPalette": ["#ff000080"]}}), + json!({"colorTable": {"deleted": vec!["#ff0000"; 257]}}), + ] { + assert!(s.execute("document.exportForWeb", &bad).is_err(), "{bad}"); + assert!(s.execute("webExport.settings", &bad).is_err(), "{bad}"); + } + // A deleted color leaves the other lists; JPEG and PNG-24 have no table to edit. + let table = json!({ + "deleted": ["#ee1100"], "customPalette": ["#ff0000", "#ee1100", "#0000ff"], "locked": ["#EE1100", "#0000ff"], + "transparent": ["#ee1100"], "webShift": ["#ee1100"], + }); + let r = run(&mut s, "webExport.settings", json!({ "colorTable": table })); + let t = r["settings"]["colorTable"].clone(); + assert_eq!((&t["locked"], &t["transparent"], &t["webShift"]), (&json!(["#0000ff"]), &json!([]), &json!([]))); + assert_eq!(t["deleted"], json!(["#ee1100"])); + for format in ["jpg", "png24"] { + assert!(preview(&mut s, json!({"format": format, "colorTable": t.clone()})).get("colors").is_none(), "{format}"); + } + // The remembered edit survives other keys and a format change, and goes with another reduction. + let r = run(&mut s, "webExport.settings", json!({"colors": 64, "format": "png8"})); + assert_eq!(r["settings"]["colorTable"]["deleted"], json!(["#ee1100"])); + let r = run(&mut s, "webExport.settings", json!({"reduction": "adaptive"})); + assert_eq!((&r["settings"]["colorTable"]["deleted"], &r["settings"]["colorTable"]["customPalette"]), (&json!([]), &json!([]))); + // A saved preset keeps the edit. + run(&mut s, "webExport.presets.save", json!({"name": "No near red", "dither": "none", "colorTable": {"deleted": ["#ee1100"]}})); + assert_eq!(sources(&preview(&mut s, json!({"preset": "No near red"}))), ["#0000ff", "#ff0000"]); +} + #[test] fn presets_and_remembered_settings() { let mut s = two_colours(); diff --git a/crates/render/src/encode/quantize.rs b/crates/render/src/encode/quantize.rs index 0c873fd598..dc459d4331 100644 --- a/crates/render/src/encode/quantize.rs +++ b/crates/render/src/encode/quantize.rs @@ -190,12 +190,13 @@ pub fn quantize_locked(rgba: &[u8], width: u32, height: u32, o: &PaletteOptions, /// [`quantize`] to the fixed `palette`: each pixel takes its nearest entry, with `o`'s dither, /// transparency and matte; `o.reduction` sets only the distance weights, and `o.colors` is not -/// used. Only the first 255 colors of `palette` are used, leaving room for the transparent entry. -/// Entries no pixel uses are left out. +/// used. Only the first 256 colors of `palette` are used, or the first 255 when a pixel becomes +/// transparent, leaving room for the transparent entry. Entries no pixel uses are left out. pub fn quantize_to(rgba: &[u8], width: u32, height: u32, o: &PaletteOptions, palette: &[[u8; 3]]) -> Indexed { let px = rgba.as_chunks::<4>().0; let colors = opaque_colors(px, o, false); - let mut palette: Vec<[u8; 3]> = palette.iter().take(255).copied().collect(); + let has_clear = o.transparency && px.iter().any(|p| p[3] < 128); + let mut palette: Vec<[u8; 3]> = palette.iter().take(256 - usize::from(has_clear)).copied().collect(); if palette.is_empty() { palette.push(o.matte.unwrap_or([255; 3])); } diff --git a/crates/render/src/encode/tests_palette.rs b/crates/render/src/encode/tests_palette.rs index 836b5fcf09..d9a8a2fc0f 100644 --- a/crates/render/src/encode/tests_palette.rs +++ b/crates/render/src/encode/tests_palette.rs @@ -102,11 +102,18 @@ fn a_given_palette_keeps_the_entries_pixels_use() { assert_eq!(ix.transparent, Some(0)); assert_eq!(ix.palette[1..], [[255, 0, 0], [0, 0, 255]], "unused entries left out, the order kept"); assert_eq!(ix.indices, [1, 2, 0, 1]); - // At most 255 of the given colors are used, leaving room for the transparent entry. + // With no transparent pixel all 256 of the given colors can be used; with one, the first 255 + // leave room for the transparent entry. let many: Vec<[u8; 3]> = (0..300u32).map(|i| [(i % 256) as u8, (i / 256) as u8, 0]).collect(); let all = image(256, 2, |x, y| [x as u8, y as u8, 0]); let ix = quantize_to(&all, 256, 2, &o, &many); - assert!(ix.palette.len() <= 255 && ix.palette.iter().all(|c| many[..255].contains(c)), "{}", ix.palette.len()); + assert!(ix.palette.len() == 256 && ix.palette.iter().all(|c| many[..256].contains(c)), "{}", ix.palette.len()); + assert!(ix.palette.contains(&many[255]), "the 256th color is used"); + let mut clear = all.clone(); + clear[3] = 0; + let ix = quantize_to(&clear, 256, 2, &o, &many); + assert_eq!(ix.transparent, Some(0)); + assert!(ix.palette.len() <= 256 && ix.palette[1..].iter().all(|c| many[..255].contains(c)), "{}", ix.palette.len()); } #[test] diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 9e54eb12f6..0d5d4d4559 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -544,8 +544,8 @@ fn hidden_controls(d: &Dialog) -> &'static [&'static str] { } // The selected rows and Randomize's seed. Some(DialogKind::Recolor) => &["__seed", "__sel"], - // The view, zoom, download speed, selected color table entry and the preset name being typed. - Some(DialogKind::SaveForWeb) => &["__color", "__kbps", "__presetName", "__view", "__zoom"], + // The view, zoom, download speed, selected color table entries and the preset name being typed. + Some(DialogKind::SaveForWeb) => &["__color", "__colors", "__kbps", "__presetName", "__view", "__zoom"], // The link that keeps width and height in proportion. Some(DialogKind::Shape | DialogKind::TransformEach) => &["__constrain"], // The attention filter, the Keys section, the search text and the key being recorded. diff --git a/crates/ui-egui/src/dialogs/save_for_web.rs b/crates/ui-egui/src/dialogs/save_for_web.rs index 589d1dfdce..54ff2b7d0a 100644 --- a/crates/ui-egui/src/dialogs/save_for_web.rs +++ b/crates/ui-egui/src/dialogs/save_for_web.rs @@ -2,13 +2,16 @@ //! as the web image Save writes, beside the original (Original, Optimized, 2-Up and 4-Up views, //! each with its file size and download time), and the settings: format (GIF, JPEG, PNG-8, //! PNG-24), colour reduction, colours, dither, transparency and matte, interlacing, web snap, -//! lossy, JPEG quality, the colour table (lock, map to transparent, web shift, sort), image size -//! and anti-aliasing, Clip to Artboard, sRGB, metadata, slices and HTML output, and presets. +//! lossy, JPEG quality, the colour table (lock, map to transparent, web shift, sort, Delete Color +//! and Restore Generated Table), image size and anti-aliasing, Clip to Artboard, sRGB, metadata, +//! slices and HTML output, and presets. //! //! Fields are the `document.exportForWeb` settings (`webExport.settings` gives them; set one with //! `ui.dialog.set`, or `preset` to load a preset), plus the dialog's own: `__view` (`original`, //! `optimized`, `2up`, `4up`), `__zoom` (`fit` or a percentage), `__kbps` (connection speed), -//! `__color` (the colour table's selected colour, by source), `__presetName` (shown while saving a +//! `__color` (the colour table's selected colour, by source: the one Lock, Transparent and Web +//! Shift edit, and where a Shift-click range starts), `__colors` (every selected color, by source, +//! which Delete Color deletes; when it is empty, `__color` alone), `__presetName` (shown while saving a //! preset) and `__hasSlices`. Optimize to File Size… (`__optimizeOpen: true`) shows `__optimizeK` (the desired size in K), //! `__optimizeStart` (`current`, `auto`) and with slices `__optimizeUse` (`allSlices`, //! `eachSlice`, `currentSlice`); `__optimizeGo: true` runs `webExport.optimizeToFileSize` and @@ -107,10 +110,10 @@ fn remembered(app: &VectorcraftApp) -> WebSettings { /// Reset (Cancel with Alt or Option held, or `ui.dialogReset`): the settings go back to the /// remembered ones on the document's active artboard ([`remembered`]), and a pending `preset`, a /// pending Done (`discard`, which a failed Done leaves), the preset name being typed and the -/// selected color table entry are dropped. The view, zoom, connection speed and `path` stay, +/// selected color table entries are dropped. The view, zoom, connection speed and `path` stay, /// nothing is remembered or written, and the dialog stays open. fn reset(app: &VectorcraftApp, d: &mut Dialog) -> Result<(), String> { - for key in ["preset", "discard", "__presetName", "__color"] { + for key in ["preset", "discard", "__presetName", "__color", "__colors"] { d.fields.remove(key); } d.fields.extend(settings_fields(&remembered(app))); @@ -737,7 +740,12 @@ fn side(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog, s: Option<& let format = s.map_or(WebFormat::Gif, |s| s.format); match format { WebFormat::Gif | WebFormat::Png8 => { + let reduction = d.str("reduction"); choice(ui, d, "reduction", tl!("Reduction:"), &pairs(&Reduction::ALL, Reduction::id, Reduction::label)); + // Another reduction makes a new palette. + if d.str("reduction") != reduction { + restore_table(d); + } colors_row(ui, d); choice(ui, d, "dither", tl!("Dither:"), &pairs(&Dither::ALL, Dither::id, Dither::label)); if Dither::from_id(&d.str("dither")).is_some_and(|x| x != Dither::None) { @@ -765,7 +773,9 @@ fn side(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog, s: Option<& choice(ui, d, "metadata", tl!("Metadata:"), &pairs(&WebMetadata::ALL, WebMetadata::key, WebMetadata::label)); if format.palette() { widgets::divider(ui); - color_table(ui, d, s); + if let Err(e) = color_table(ui, d, s) { + app.status(e); + } } widgets::divider(ui); image_size(app, ui, d, s); @@ -1043,10 +1053,13 @@ fn matte_row(ui: &mut egui::Ui, d: &mut Dialog) { }); } -/// The colour table of the current settings' preview: swatches (the selected one ringed; locked -/// ones with a square, web-safe ones with a diamond, transparent ones over the grid) and the -/// buttons that edit the selected colour, plus the sort order. -fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) { +/// The colour table of the current settings' preview: swatches (the selected ones ringed; locked +/// ones with a square, web-safe ones with a diamond, transparent ones over the grid), the buttons +/// that edit the selected colour, Delete Color and the table's menu, plus the sort order. A click +/// selects one color, a Shift-click the colors from the anchor, and a Ctrl-click +/// (Command-click on macOS) adds or removes one. Returns an error for a deletion that would leave +/// no color. +fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Result<(), String> { let t = Tokens::get(ui.ctx()); let cache: Option = ui.ctx().data(|m| m.get_temp(cache_id())); let key = s.map(|s| s.to_json().to_string()); @@ -1054,10 +1067,20 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) { let Some(shot) = shot else { widgets::subheader(ui, tl!("Color Table")); widgets::dim_label(ui, tl!("Shown with the optimised preview.")); - return; + // A Custom table the preview can't use (a deletion that left only colors mapped to + // transparent) can still go back to the generated palette. + if s.is_some_and(|s| s.color_table.is_custom()) && widgets::flat_button_fit(ui, tl!("Restore Generated Table"), 88.0).clicked() { + restore_table(d); + } + return Ok(()); }; + let table = s.map(|s| s.color_table.clone()).unwrap_or_default(); widgets::subheader(ui, &crate::i18n::tn(shot.colors.len() as u64, "Color Table ({n} color)", "Color Table ({n} colors)")); + if table.is_custom() { + widgets::dim_label(ui, tl!("Custom")); + } let selected = d.str("__color"); + let picked = selection(d); // (colour shown, source, transparent, locked, web-safe, mapped by hand) let rows: Vec<(TableColor, bool)> = shot .colors @@ -1069,6 +1092,9 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) { let per_row = ((SIDE_W - 8.0) / (CELL + 2.0)).floor().max(1.0) as usize; let lines = rows.len().div_ceil(per_row).max(1); let (area, resp) = ui.allocate_exact_size(egui::vec2(SIDE_W - 8.0, lines as f32 * (CELL + 2.0)), egui::Sense::click()); + // The colors that can be selected, in table order (for Shift-click ranges). + let order: Vec = rows.iter().filter(|(c, mapped)| !c.transparent || *mapped).map(|(c, _)| hex(c.source)).collect(); + let mut clicked = None; let p = ui.painter(); for (i, (c, mapped)) in rows.iter().enumerate() { let r = egui::Rect::from_min_size( @@ -1102,14 +1128,17 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) { } // The transparent entry itself isn't a colour to edit. let pickable = !c.transparent || *mapped; - let picked = pickable && hex(c.source) == selected; - p.rect_stroke(r, 0.0, egui::Stroke::new(if picked { 2.0 } else { 1.0 }, if picked { t.accent } else { t.border }), egui::StrokeKind::Outside); + let ringed = pickable && picked.iter().any(|h| h.eq_ignore_ascii_case(&hex(c.source))); + p.rect_stroke(r, 0.0, egui::Stroke::new(if ringed { 2.0 } else { 1.0 }, if ringed { t.accent } else { t.border }), egui::StrokeKind::Outside); if pickable && resp.clicked() && resp.interact_pointer_pos().is_some_and(|pos| r.contains(pos)) { - d.fields.insert("__color".into(), json!(hex(c.source))); + clicked = Some(hex(c.source)); } } + if let Some(c) = clicked { + let m = ui.input(|i| i.modifiers); + pick(d, &order, &c, m.shift, m.command); + } ui.add_space(4.0); - let table = s.map(|s| s.color_table.clone()).unwrap_or_default(); let on = |list: &[String]| list.iter().any(|h| h.eq_ignore_ascii_case(&selected)); ui.horizontal(|ui| { ui.add_enabled_ui(!selected.is_empty(), |ui| { @@ -1130,6 +1159,23 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) { } }); }); + // Delete Color (the button and the table's menu) and Restore Generated Table. + let (mut delete, mut restore) = (false, false); + ui.horizontal(|ui| { + delete |= widgets::icon_button_enabled(ui, "trash-2", tl!("Delete Color"), false, !picked.is_empty(), 24.0).clicked(); + let menu = widgets::icon_button(ui, "menu", tl!("Color Table"), false, 24.0); + let open = menu.clicked(); + let _ = widgets::popover(&menu, open, |ui| { + if widgets::menu_item(ui, tl!("Delete Color"), !picked.is_empty(), false) { + delete = true; + ui.close(); + } + if widgets::menu_item(ui, tl!("Restore Generated Table"), table.is_custom(), false) { + restore = true; + ui.close(); + } + }); + }); let sort = table.sort; widgets::label_row(ui, tl!("Order:"), LABEL_W, |ui| { let labels = ColorSort::ALL.map(ColorSort::label); @@ -1139,6 +1185,118 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) { set_table(d, "sort", json!(o.id())); } }); + if restore { + restore_table(d); + } + if delete { + let palette: Vec = + shot.colors.iter().filter(|c| !c.transparent).map(|c| hex(c.source)).chain(shot.mapped.iter().map(|c| hex(*c))).collect(); + delete_colors(d, &palette)?; + } + Ok(()) +} + +/// The colour table's selected colors, by source: `__colors`, else `__color`. +pub(super) fn selection(d: &Dialog) -> Vec { + let many: Vec = + d.fields.get("__colors").and_then(Value::as_array).into_iter().flatten().filter_map(Value::as_str).map(str::to_ascii_lowercase).collect(); + if !many.is_empty() { + return many; + } + let one = d.str("__color"); + if one.is_empty() { vec![] } else { vec![one.to_ascii_lowercase()] } +} + +/// A click on the table's color `color`: it alone is selected and becomes the anchor (`__color`); +/// with `shift`, the colors from the anchor to it in table order (`order`), the anchor unchanged; +/// with `command` (Ctrl, or Command on macOS), it is added to the selection and becomes the anchor, +/// or taken out, and the anchor moves to the last color left in the selection. +pub(super) fn pick(d: &mut Dialog, order: &[String], color: &str, shift: bool, command: bool) { + let color = color.to_ascii_lowercase(); + let at = |c: &str| order.iter().position(|o| o.eq_ignore_ascii_case(c)); + if shift && let (Some(a), Some(b)) = (at(&d.str("__color")), at(&color)) { + let range: Vec = order[a.min(b)..=a.max(b)].iter().map(|c| c.to_ascii_lowercase()).collect(); + d.fields.insert("__colors".into(), json!(range)); + return; + } + let mut set = selection(d); + let anchor = if command { + match set.iter().position(|c| *c == color) { + Some(i) => { + set.remove(i); + set.last().cloned() + } + None => { + set.push(color.clone()); + Some(color) + } + } + } else { + set = vec![color.clone()]; + Some(color) + }; + d.fields.insert("__colors".into(), json!(set)); + match anchor { + Some(c) => d.fields.insert("__color".into(), json!(c)), + None => d.fields.remove("__color"), + }; +} + +/// Delete Color: the selected colors join the color table's `deleted` list and leave its other +/// lists. The first deletion fixes the palette (`customPalette`) to `palette`, the table's colors +/// (by source) with the deleted ones, so the colors left do not change. A deletion that leaves no +/// color, or only colors mapped to transparent, is refused with nothing changed. The selection is +/// cleared. +pub(super) fn delete_colors(d: &mut Dialog, palette: &[String]) -> Result<(), String> { + let picked = selection(d); + if picked.is_empty() { + return Ok(()); + } + let list = |d: &Dialog, key: &str| -> Vec { + d.fields + .get("colorTable") + .and_then(|t| t.get(key)) + .and_then(Value::as_array) + .into_iter() + .flatten() + .filter_map(Value::as_str) + .map(str::to_ascii_lowercase) + .collect() + }; + let mut custom = list(d, "customPalette"); + if custom.is_empty() { + custom = palette.iter().map(|c| c.to_ascii_lowercase()).collect(); + } + let mut deleted = list(d, "deleted"); + for c in &picked { + if !deleted.contains(c) { + deleted.push(c.clone()); + } + } + // A color has to stay that is neither deleted nor mapped to transparent. + let clear: Vec = list(d, "transparent").into_iter().filter(|c| !picked.contains(c)).collect(); + if custom.iter().all(|c| deleted.contains(c) || clear.contains(c)) { + return Err(webexport::KEEP_ONE.into()); + } + for key in ["locked", "transparent", "webShift"] { + if list(d, key).iter().any(|c| picked.contains(c)) { + for c in &picked { + toggle(d, key, c, false); + } + } + } + set_table(d, "customPalette", json!(custom)); + set_table(d, "deleted", json!(deleted)); + d.fields.remove("__colors"); + d.fields.remove("__color"); + Ok(()) +} + +/// Restore Generated Table: no deleted colors and no fixed palette; the reduction makes the +/// palette again. +pub(super) fn restore_table(d: &mut Dialog) { + set_table(d, "deleted", json!([])); + set_table(d, "customPalette", json!([])); } /// Add `color` to the colour table's `list`, or take it out. diff --git a/crates/ui-egui/src/dialogs/tests_save_for_web.rs b/crates/ui-egui/src/dialogs/tests_save_for_web.rs index 17c565e454..e27f4b766c 100644 --- a/crates/ui-egui/src/dialogs/tests_save_for_web.rs +++ b/crates/ui-egui/src/dialogs/tests_save_for_web.rs @@ -727,6 +727,141 @@ fn colour_table_buttons_edit_the_lists() { assert_eq!(d.fields["colorTable"], json!({"locked": [], "webShift": ["#123456"], "sort": "hue"})); } +/// A click selects one color, a Shift-click the range from the last one clicked, a Ctrl-click +/// (Command-click) adds or removes one; Delete Color deletes the whole selection in one edit, +/// takes it out of the other lists, fixes the palette and refuses to delete every color. +#[test] +fn colour_table_selection_and_delete_color() { + let mut d = Dialog::new(save_for_web::KIND, json!({})); + let order: Vec = ["#000000", "#111111", "#222222", "#333333"].map(String::from).to_vec(); + let sel = |d: &Dialog| save_for_web::selection(d); + assert!(sel(&d).is_empty()); + save_for_web::pick(&mut d, &order, "#111111", false, false); + assert_eq!(sel(&d), ["#111111"]); + save_for_web::pick(&mut d, &order, "#333333", true, false); + assert_eq!((sel(&d), d.str("__color")), (vec!["#111111".to_string(), "#222222".into(), "#333333".into()], "#111111".into())); + save_for_web::pick(&mut d, &order, "#222222", false, true); + assert_eq!(sel(&d), ["#111111", "#333333"]); + save_for_web::pick(&mut d, &order, "#000000", false, true); + assert_eq!((sel(&d), d.str("__color")), (vec!["#111111".to_string(), "#333333".into(), "#000000".into()], "#000000".into())); + save_for_web::pick(&mut d, &order, "#000000", false, true); + assert_eq!((sel(&d), d.str("__color")), (vec!["#111111".to_string(), "#333333".into()], "#333333".into())); + // A Shift-click back from the anchor. + save_for_web::pick(&mut d, &order, "#222222", false, false); + save_for_web::pick(&mut d, &order, "#000000", true, false); + assert_eq!(sel(&d), ["#000000", "#111111", "#222222"]); + // `__color` alone (an agent's selection) is the selection too. + d.fields.remove("__colors"); + d.fields.insert("__color".into(), json!("#222222")); + assert_eq!(sel(&d), ["#222222"]); + + save_for_web::toggle(&mut d, "locked", "#222222", true); + save_for_web::toggle(&mut d, "locked", "#000000", true); + save_for_web::toggle(&mut d, "webShift", "#333333", true); + save_for_web::pick(&mut d, &order, "#333333", false, true); + save_for_web::delete_colors(&mut d, &order).unwrap(); + assert_eq!(d.fields["colorTable"], json!({"locked": ["#000000"], "webShift": [], "customPalette": order, "deleted": ["#222222", "#333333"]})); + assert!(!d.fields.contains_key("__colors") && !d.fields.contains_key("__color") && sel(&d).is_empty()); + // Nothing selected: nothing deleted. + let before = d.fields.clone(); + save_for_web::delete_colors(&mut d, &order).unwrap(); + assert_eq!(d.fields, before); + // The colors left can't all go: refused, nothing changed. + save_for_web::pick(&mut d, &order, "#000000", false, false); + save_for_web::pick(&mut d, &order, "#111111", false, true); + let before = d.fields.clone(); + assert_eq!(save_for_web::delete_colors(&mut d, &order), Err(vectorcraft_engine::cmd::webexport::KEEP_ONE.to_string())); + assert_eq!(d.fields, before); + // Nor can the last color that is not mapped to transparent. + save_for_web::toggle(&mut d, "transparent", "#111111", true); + save_for_web::pick(&mut d, &order, "#000000", false, false); + let before = d.fields.clone(); + assert_eq!(save_for_web::delete_colors(&mut d, &order), Err(vectorcraft_engine::cmd::webexport::KEEP_ONE.to_string())); + assert_eq!(d.fields, before); + // Restore Generated Table. + save_for_web::restore_table(&mut d); + assert_eq!((&d.fields["colorTable"]["deleted"], &d.fields["colorTable"]["customPalette"]), (&json!([]), &json!([]))); +} + +/// Click the dialog's text `label` with the pointer (frames a quarter second apart). +fn click_text(app: &mut VectorcraftApp, label: &str) { + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let frame = |app: &mut VectorcraftApp, events: Vec| { + let time = ctx.input(|i| i.time) + 0.25; + let screen_rect = Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1400.0, 1000.0))); + let raw = egui::RawInput { screen_rect, events, time: Some(time), ..Default::default() }; + let mut out = ctx.run_ui(raw, |ui| show(app, ui.ctx())); + out.textures_delta.clear(); + fn walk(s: &egui::Shape, v: &mut Vec<(String, egui::Rect)>) { + match s { + egui::Shape::Text(t) => v.push((t.galley.text().to_string(), egui::Rect::from_min_size(t.pos, t.galley.size()))), + egui::Shape::Vec(s) => s.iter().for_each(|s| walk(s, v)), + _ => {} + } + } + let mut v = vec![]; + out.shapes.iter().for_each(|c| walk(&c.shape, &mut v)); + v + }; + frame(app, vec![]); + let texts = frame(app, vec![]); + let at = texts.iter().find(|(t, _)| t == label).map(|(_, r)| r.center()).unwrap_or_else(|| panic!("no `{label}` in {texts:?}")); + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + frame(app, vec![egui::Event::PointerMoved(at)]); + frame(app, vec![press(true)]); + frame(app, vec![press(false)]); +} + +/// A Custom table whose preview fails (only a color mapped to transparent left) still offers +/// Restore Generated Table, which brings the preview back. +#[test] +fn restore_generated_table_shows_when_the_preview_fails() { + let dir = vectorcraft_testkit::temp_dir("sfw-restore-table"); + let (mut app, _) = app(&dir, false); + app.run("shape.rectangle", json!({"x": 40, "y": 0, "width": 20, "height": 40})).unwrap(); + app.run("paint.setFill", json!({"color": "#0000ff"})).unwrap(); + app.run("file.saveForWeb", json!({})).unwrap(); + let table = json!({"deleted": ["#cc3300"], "customPalette": ["#cc3300", "#0000ff"], "transparent": ["#0000ff"]}); + for (k, v) in [("format", json!("gif")), ("antiAlias", json!("none")), ("dither", json!("none")), ("colorTable", table)] { + set(&mut app, k, v); + } + let p = json!({"format": "gif", "antiAlias": "none", "colorTable": app.ui.dialog.as_ref().unwrap().fields["colorTable"].clone()}); + assert!(app.session.execute("document.exportForWeb.preview", &p).is_err(), "the preview fails"); + click_text(&mut app, "Restore Generated Table"); + let t = &app.ui.dialog.as_ref().unwrap().fields["colorTable"]; + assert_eq!((&t["deleted"], &t["customPalette"]), (&json!([]), &json!([]))); +} + +/// The saved file lacks the deleted color, whose pixels take the color left; the edit is +/// remembered, reopens with the dialog and stays through a format change. +#[test] +fn delete_color_reaches_the_saved_file_and_is_remembered() { + let dir = vectorcraft_testkit::temp_dir("sfw-delete-color"); + let (mut app, _) = app(&dir, false); + app.run("shape.rectangle", json!({"x": 40, "y": 0, "width": 20, "height": 40})).unwrap(); + app.run("paint.setFill", json!({"color": "#0000ff"})).unwrap(); + app.run("file.saveForWeb", json!({})).unwrap(); + for (k, v) in [("format", json!("gif")), ("antiAlias", json!("none")), ("dither", json!("none"))] { + set(&mut app, k, v); + } + frame(&mut app); + set(&mut app, "__colors", json!(["#cc3300"])); + save_for_web::delete_colors(app.ui.dialog.as_mut().unwrap(), &["#cc3300".into(), "#0000ff".into()]).unwrap(); + frame(&mut app); + for format in ["jpg", "gif"] { + set(&mut app, "format", json!(format)); + frame(&mut app); + } + let r = confirm(&mut app).unwrap(); + let image = image::open(r["path"].as_str().unwrap()).unwrap().to_rgba8(); + assert_eq!((image.get_pixel(20, 14).0, image.get_pixel(50, 20).0), ([0, 0, 255, 255], [0, 0, 255, 255])); + assert_eq!(app.session.last_web_settings().color_table.deleted, ["#cc3300"]); + app.run("file.saveForWeb", json!({})).unwrap(); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["colorTable"]["deleted"], json!(["#cc3300"])); + frame(&mut app); +} + #[test] fn optimize_to_file_size_takes_the_settings_that_fit() { let dir = vectorcraft_testkit::temp_dir("sfw-optimize"); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index bb039bb08e..cda439137f 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -768,6 +768,8 @@ font-technology Variable Променливи Delete Artboard Изтриване на работна област Delete Artboards Изтриване на работни области Delete Brush Изтриване на четка + Delete Color Изтриване на цвят + Restore Generated Table Възстановяване на генерираната таблица Delete Character Style Изтриване на стил за знаци Delete Empty Artboards Изтриване на празни работни области Delete Freeform Point Изтриване на свободна точка @@ -4583,6 +4585,7 @@ axis Both И двете @msg choose a folder to export to изберете папка за експортиране @msg choose a location for the package изберете местоположение за пакета @msg clipboard is empty клипбордът е празен +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: поне един цвят трябва да остане в цветовата таблица @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` не е цвят като "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: най-много {MAX_TABLE} цвята @msg command `{0}` is not available right now: {1} команда `{0}` не е налична в момента: {1} diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 99f23d313c..57ff2c9bad 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -3437,6 +3437,8 @@ theme Appearance Izgled Current Brush Trenutna četkica Current Symbol Trenutni simbol Delete Brush Izbriši četkicu + Delete Color Izbriši boju + Restore Generated Table Vrati generisanu tabelu Delete Symbol Izbriši simbol Delete the selected symbol? Izbrisati odabrani simbol? Delete the selected symbols? Izbrisati odabrane simbole? @@ -4986,6 +4988,7 @@ imageTrace Outline Obris @msg choose a folder to export to odaberite folder za izvoz @msg choose a location for the package odaberite lokaciju za paket @msg clipboard is empty međuspremnik je prazan +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: barem jedna boja mora ostati u tabeli boja @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` nije boja poput "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: najviše {MAX_TABLE} boja @msg command `{0}` is not available right now: {1} naredba `{0}` trenutno nije dostupna: {1} diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index c54311799d..48c5b4c00b 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -1126,6 +1126,8 @@ antiAlias Sharp Nítid Delete Artboard Suprimeix el tauler Delete Artboards Suprimeix els taulers Delete Brush Suprimeix el pinzell + Delete Color Suprimeix el color + Restore Generated Table Restaura la taula generada Delete Character Style Suprimeix l’estil de caràcter Delete Data Set Suprimeix el conjunt de dades Delete Data Sets Suprimeix els conjunts de dades @@ -5754,6 +5756,7 @@ digits Malayalam Malaiàlam @msg Choose two nonzero angle arms Trieu dos braços d’angle no nuls @msg clipboard is empty el porta-retalls és buit @msg closing needs three anchors el tancament necessita tres punts d’ancoratge +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: almenys un color ha de quedar a la taula de colors @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` no és un color com "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: com a màxim {MAX_TABLE} colors @msg column docks a set as a dock column, with no anchor or icon column acobla un conjunt com a columna d’acoblament, sense àncora ni icona diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index a5d7bb948a..fe259f7d2a 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -3535,6 +3535,8 @@ theme Appearance Motiv Current Brush Aktuální štětec Current Symbol Aktuální symbol Delete Brush Odstranit štětec + Delete Color Odstranit barvu + Restore Generated Table Obnovit vygenerovanou tabulku Delete Symbol Odstranit symbol Delete the selected symbol? Odstranit vybraný symbol? Delete the selected symbols? Odstranit vybrané symboly? @@ -5246,6 +5248,7 @@ liquify-list-end {0}, {1} {0} a {1} @msg choose a folder to export to zvolte složku pro export @msg choose a location for the package zvolte umístění balíčku @msg clipboard is empty schránka je prázdná +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: v tabulce barev musí zůstat alespoň jedna barva @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` není barva jako "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: nejvýše {MAX_TABLE} barev @msg command `{0}` is not available right now: {1} příkaz `{0}` nyní není k dispozici: {1} diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 08100f593f..730d909f66 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5959,6 +5959,8 @@ theme Appearance Udseende Current Brush Aktuel pensel Current Symbol Aktuelt symbol Delete Brush Slet pensel + Delete Color Slet farve + Restore Generated Table Gendan genereret tabel Delete Symbol Slet symbol Delete the selected symbol? Vil du slette det markerede symbol? Delete the selected symbols? Vil du slette de markerede symboler? @@ -7446,6 +7448,7 @@ imageTrace Outline Kontur @msg choose a folder to export to vælg en mappe at eksportere til @msg choose a location for the package vælg en placering til pakken @msg clipboard is empty udklipsholderen er tom +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: mindst én farve skal blive i farvetabellen @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` er ikke en farve som "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: højst {MAX_TABLE} farver @msg command `{0}` is not available right now: {1} kommandoen `{0}` er ikke tilgængelig lige nu: {1} diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 10147b2d45..89ab929ec9 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -771,6 +771,8 @@ font-technology Variable Variabel Delete Artboard Zeichenfläche löschen Delete Artboards Zeichenflächen löschen Delete Brush Pinsel löschen + Delete Color Farbe löschen + Restore Generated Table Generierte Tabelle wiederherstellen Delete Character Style Zeichenformat löschen Delete Empty Artboards Leere Zeichenflächen löschen Delete Freeform Point Freiformpunkt löschen @@ -4847,6 +4849,7 @@ liquify-list-end {0}, {1} {0} und {1} @msg choose a folder to export to wählen Sie einen Ordner für den Export @msg choose a location for the package wählen Sie einen Speicherort für das Paket @msg clipboard is empty die Zwischenablage ist leer +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: Mindestens eine Farbe muss in der Farbtabelle bleiben @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` ist keine Farbe wie "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: höchstens {MAX_TABLE} Farben @msg command `{0}` is not available right now: {1} der Befehl `{0}` ist derzeit nicht verfügbar: {1} diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 1ebf6e5684..1d67762e3a 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -749,6 +749,8 @@ font-technology Variable Μεταβλητές Delete Artboard Διαγραφή πίνακα σχεδίασης Delete Artboards Διαγραφή πινάκων σχεδίασης Delete Brush Διαγραφή πινέλου + Delete Color Διαγραφή χρώματος + Restore Generated Table Επαναφορά του παραγόμενου πίνακα Delete Character Style Διαγραφή στυλ χαρακτήρων Delete Empty Artboards Διαγραφή κενών πινάκων σχεδίασης Delete Freeform Point Διαγραφή ελεύθερου σημείου @@ -4905,6 +4907,7 @@ digits Malayalam Μαλαγιάλαμ @msg choose a folder to export to επιλέξτε φάκελο εξαγωγής @msg choose a location for the package επιλέξτε τοποθεσία συσκευασίας @msg clipboard is empty το πρόχειρο είναι κενό +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: τουλάχιστον ένα χρώμα πρέπει να παραμείνει στον πίνακα χρωμάτων @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: το `{h}` δεν είναι έγκυρο χρώμα, όπως το "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: επιτρέπονται το πολύ {MAX_TABLE} χρώματα @msg command `{0}` is not available right now: {1} η εντολή `{0}` δεν είναι διαθέσιμη αυτήν τη στιγμή: {1} diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index a456910a16..f47a234d37 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -790,6 +790,8 @@ font-technology Variable Variables Delete Artboard Eliminar mesa de trabajo Delete Artboards Eliminar mesas de trabajo Delete Brush Eliminar pincel + Delete Color Eliminar color + Restore Generated Table Restaurar tabla generada Delete Character Style Eliminar estilo de carácter Delete Empty Artboards Eliminar mesas de trabajo vacías Delete Freeform Point Eliminar punto libre @@ -4951,6 +4953,7 @@ liquify-list-end {0}, {1} {0}, {1} @msg choose a folder to export to elige una carpeta a la que exportar @msg choose a location for the package elige una ubicación para el paquete @msg clipboard is empty el portapapeles está vacío +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: al menos un color debe quedar en la tabla de colores @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` no es un color como "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: como máximo {MAX_TABLE} colores @msg command `{0}` is not available right now: {1} el comando `{0}` no está disponible ahora: {1} diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index bff46fc0d7..401c184194 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -3474,6 +3474,8 @@ theme Appearance Ulkoasu Current Brush Nykyinen sivellin Current Symbol Nykyinen symboli Delete Brush Poista sivellin + Delete Color Poista väri + Restore Generated Table Palauta luotu taulukko Delete Symbol Poista symboli Delete the selected symbol? Poistetaanko valittu symboli? Delete the selected symbols? Poistetaanko valitut symbolit? @@ -5175,6 +5177,7 @@ liquify-list-end {0}, {1} {0} ja {1} @msg choose a folder to export to valitse kansio, johon viedään @msg choose a location for the package valitse paketin sijainti @msg clipboard is empty leikepöytä on tyhjä +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: väritaulukkoon on jäätävä vähintään yksi väri @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` ei ole väri, kuten "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: enintään {MAX_TABLE} väriä @msg command `{0}` is not available right now: {1} komento `{0}` ei ole nyt käytettävissä: {1} diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3be3497f97..c18264aab3 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -792,6 +792,8 @@ font-technology Variable Variables Delete Artboard Supprimer le plan de travail Delete Artboards Supprimer les plans de travail Delete Brush Supprimer la forme + Delete Color Supprimer la couleur + Restore Generated Table Restaurer la table générée Delete Character Style Supprimer le style de caractère Delete Empty Artboards Supprimer les plans de travail vides Delete Freeform Point Supprimer le point libre @@ -4913,6 +4915,7 @@ liquify-list-end {0}, {1} {0} et {1} @msg choose a folder to export to choisissez un dossier d’exportation @msg choose a location for the package choisissez un emplacement pour l’assemblage @msg clipboard is empty le presse-papiers est vide +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: au moins une couleur doit rester dans la table des couleurs @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what} : `{h}` n’est pas une couleur comme "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what} : {MAX_TABLE} couleurs au maximum @msg command `{0}` is not available right now: {1} la commande `{0}` n’est pas disponible pour le moment : {1} diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index c427fc527c..ab25098e64 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -903,6 +903,8 @@ Delete Artboard આર્ટબોર્ડ કાઢી નાખો Delete Artboards આર્ટબોર્ડ્સ કાઢી નાખો Delete Brush બ્રશ કાઢી નાખો + Delete Color રંગ કાઢી નાખો + Restore Generated Table જનરેટ થયેલું ટેબલ પુનઃસ્થાપિત કરો Delete Character Style અક્ષર સ્ટાઇલ કાઢી નાખો Delete Data Set ડેટા સેટ કાઢી નાખો Delete Data Sets ડેટા સેટ્સ કાઢી નાખો diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index cbfb4f51d1..4cfe7e623b 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -1289,6 +1289,8 @@ antiAlias Sharp शार्प Delete Artboard आर्टबोर्ड हटाएँ Delete Artboards आर्टबोर्ड्स हटाएँ Delete Brush ब्रश हटाएँ + Delete Color रंग हटाएँ + Restore Generated Table जनरेट की गई तालिका पुनर्स्थापित करें Delete Character Style कैरेक्टर स्टाइल हटाएँ Delete Data Set डेटा सेट हटाएँ Delete Data Sets डेटा सेट्स हटाएँ @@ -6859,6 +6861,7 @@ antiAlias Sharp शार्प @msg color.profile: no RGB or CMYK profile is called “{profile}” color.profile: "{profile}" नाम की कोई RGB या CMYK प्रोफ़ाइल नहीं है @msg colorMode must be rgb or cmyk, not `{m}` colorMode को rgb या cmyk होना चाहिए, `{m}` नहीं @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel को {own} (डॉक्यूमेंट का मोड), grayscale या bitmap होना चाहिए +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: रंग तालिका में कम से कम एक रंग रहना चाहिए @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}`, "#ff8800" जैसा रंग नहीं है @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: अधिकतम {MAX_TABLE} रंग @msg colour groups can't go into colour groups रंग समूह रंग समूहों में नहीं जा सकते हैं diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0f81a72036..9b86b896c6 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -1018,6 +1018,8 @@ font-technology Variable Változó Delete Artboard Rajztábla törlése Delete Artboards Rajztáblák törlése Delete Brush Ecset törlése + Delete Color Szín törlése + Restore Generated Table Előállított tábla visszaállítása Delete Character Style Karakterstílus törlése Delete Data Set Adatkészlet törlése Delete Empty Artboards Üres rajztáblák törlése @@ -5349,6 +5351,7 @@ imageTrace Outline Körvonal @msg choose the font files to add válaszd ki a hozzáadandó betűtípusfájlokat @msg clipboard is empty a vágólap üres @msg closing needs three anchors a lezáráshoz három horgonypont kell +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: legalább egy színnek a színtáblában kell maradnia @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` nem szín (például "#ff8800") @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: legfeljebb {MAX_TABLE} szín @msg column must be true or a number from 1 a column értéke true vagy 1-től kezdődő szám lehet diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 28ea2b5ab3..82205755a8 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3211,6 +3211,8 @@ theme Appearance Tampilan Current Brush Kuas saat ini Current Symbol Simbol saat ini Delete Brush Hapus kuas + Delete Color Hapus warna + Restore Generated Table Pulihkan tabel yang dibuat Delete Symbol Hapus simbol Delete the selected symbol? Hapus simbol yang dipilih? Delete the selected symbols? Hapus simbol yang dipilih? @@ -4697,6 +4699,7 @@ imageTrace Outline Kontur @msg choose a folder to export to pilih folder tujuan ekspor @msg choose a location for the package pilih lokasi untuk paket @msg clipboard is empty papan klip kosong +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: setidaknya satu warna harus tetap ada di tabel warna @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` bukan warna seperti "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: maksimal {MAX_TABLE} warna @msg command `{0}` is not available right now: {1} perintah `{0}` tidak tersedia saat ini: {1} diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 8f2ed3216c..eba8303c86 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -792,6 +792,8 @@ font-technology Variable Variabili Delete Artboard Elimina tavola da disegno Delete Artboards Elimina tavole da disegno Delete Brush Elimina pennello + Delete Color Elimina colore + Restore Generated Table Ripristina tabella generata Delete Character Style Elimina stile carattere Delete Empty Artboards Elimina tavole da disegno vuote Delete Freeform Point Elimina punto libero @@ -4981,6 +4983,7 @@ liquify-list-end {0}, {1} {0} e {1} @msg choose a folder to export to scegli una cartella in cui esportare @msg choose a location for the package scegli una posizione per il pacchetto @msg clipboard is empty gli appunti sono vuoti +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: almeno un colore deve restare nella tabella colori @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` non è un colore come "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: al massimo {MAX_TABLE} colori @msg command `{0}` is not available right now: {1} il comando `{0}` non è disponibile in questo momento: {1} diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c429f204a1..a5f4afba8b 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -1479,6 +1479,8 @@ antiAlias Sharp シャープ Delete Artboard アートボードを削除 Delete Artboards アートボードを削除 Delete Brush ブラシを削除 + Delete Color カラーを削除 + Restore Generated Table 生成されたテーブルを復元 Delete Character Style 文字スタイルを削除 Delete Empty Artboards 空のアートボードを削除 Delete Freeform Point フリーフォームポイントを削除 @@ -4967,6 +4969,7 @@ swatch Bright Violet ビビッドバイオレット @msg Create Outlines: select text objects アウトラインを作成: テキストオブジェクトを選択してください @msg paste unavailable 貼り付けを使用できません @msg Save for Web: the image is empty Web 用に保存: 画像が空です +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: カラーテーブルには少なくとも 1 つのカラーを残す必要があります @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` は「#ff8800」のような形式のカラーではありません @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: 指定できるカラーは {MAX_TABLE} 色までです @msg no artboard {i} (0-based; the document has {_1}) アートボード {i} はありません (番号は 0 始まり、このドキュメントには {_1} 個あります) diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 414f45171c..493ead6476 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5301,6 +5301,8 @@ theme Appearance იერსახე Current Brush მიმდინარე ფუნჯი Current Symbol მიმდინარე სიმბოლო Delete Brush ფუნჯის წაშლა + Delete Color ფერის წაშლა + Restore Generated Table გენერირებული ცხრილის აღდგენა Delete Symbol სიმბოლოს წაშლა Delete the selected symbol? წაიშალოს მონიშნული სიმბოლო? Delete the selected symbols? წაიშალოს მონიშნული სიმბოლოები? @@ -6764,6 +6766,7 @@ font-technology Variable ცვლადი @msg choose a folder to export to აირჩიეთ ექსპორტის საქაღალდე @msg choose a location for the package აირჩიეთ შეფუთვის მდებარეობა @msg clipboard is empty გაცვლის ბუფერი ცარიელია +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: ფერების ცხრილში ერთი ფერი მაინც უნდა დარჩეს @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` ფერი არ არის, მაგალითად "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: არაუმეტეს {MAX_TABLE} ფერი @msg command `{0}` is not available right now: {1} ბრძანება `{0}` ახლა ხელმისაწვდომი არ არის: {1} diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index dbda53243f..497bc1a9d2 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -1469,6 +1469,8 @@ antiAlias Sharp 날카롭게 Delete Artboard 아트보드 삭제 Delete Artboards 아트보드 삭제 Delete Brush 브러시 삭제 + Delete Color 색상 삭제 + Restore Generated Table 생성된 표 복원 Delete Character Style 문자 스타일 삭제 Delete Empty Artboards 빈 아트보드 삭제 Delete Freeform Point 자유 형태 포인트 삭제 @@ -4894,6 +4896,7 @@ theme Appearance 외관 @msg Create Outlines: select text objects 윤곽선 만들기: 텍스트 개체를 선택하세요 @msg paste unavailable 붙여넣을 수 없습니다 @msg Save for Web: the image is empty 웹용으로 저장: 이미지가 비어 있습니다 +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: 색상 표에 색상이 하나 이상 남아 있어야 합니다 @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}`은(는) "#ff8800" 같은 색상이 아닙니다 @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: 색상은 최대 {MAX_TABLE}개입니다 @msg no artboard {i} (0-based; the document has {_1}) 아트보드 {i}이(가) 없습니다(0부터 시작, 문서의 아트보드 수: {_1}) diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 69aef91cfc..c78d63f4f7 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -3833,6 +3833,8 @@ theme Appearance Vormgeving Current Brush Huidig penseel Current Symbol Huidig symbool Delete Brush Penseel verwijderen + Delete Color Kleur verwijderen + Restore Generated Table Gegenereerde tabel herstellen Delete Symbol Symbool verwijderen Delete the selected symbol? Het geselecteerde symbool verwijderen? Delete the selected symbols? De geselecteerde symbolen verwijderen? @@ -5321,6 +5323,7 @@ imageTrace Outline Contour @msg choose a folder to export to kies een map om naar te exporteren @msg choose a location for the package kies een locatie voor het pakket @msg clipboard is empty het klembord is leeg +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: er moet ten minste één kleur in de kleurentabel blijven @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` is geen kleur zoals "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: maximaal {MAX_TABLE} kleuren @msg command `{0}` is not available right now: {1} opdracht `{0}` is nu niet beschikbaar: {1} diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 0147515ffe..9bfba7cfec 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -3414,6 +3414,8 @@ theme Appearance Wygląd Current Brush Bieżący pędzel Current Symbol Bieżący symbol Delete Brush Usuń pędzel + Delete Color Usuń kolor + Restore Generated Table Przywróć wygenerowaną tablicę Delete Symbol Usuń symbol Delete the selected symbol? Usunąć zaznaczony symbol? Delete the selected symbols? Usunąć zaznaczone symbole? @@ -5069,6 +5071,7 @@ liquify-list-end {0}, {1} {0} i {1} @msg choose a folder to export to wybierz folder docelowy eksportu @msg choose a location for the package wybierz lokalizację pakietu @msg clipboard is empty schowek jest pusty +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: w tablicy kolorów musi zostać co najmniej jeden kolor @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` nie jest kolorem w rodzaju "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: maksymalnie {MAX_TABLE} kolorów @msg command `{0}` is not available right now: {1} polecenie `{0}` jest teraz niedostępne: {1} diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 8201db7ab6..23cc28de85 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -704,6 +704,8 @@ antiAlias Sharp Nítido Delete Artboard Excluir Mesa de Trabalho Delete Artboards Excluir Mesas de Trabalho Delete Brush Excluir Pincel + Delete Color Excluir Cor + Restore Generated Table Restaurar Tabela Gerada Delete Character Style Excluir Estilo de Caractere Delete Empty Artboards Excluir Mesas de Trabalho Vazias Delete Freeform Point Excluir Ponto Livre @@ -4256,6 +4258,7 @@ axis Both Ambos @msg choose a folder to export to escolha uma pasta para exportar @msg choose a location for the package escolha um local para o pacote @msg clipboard is empty a área de transferência está vazia +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: pelo menos uma cor deve permanecer na tabela de cores @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` não é uma cor como "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: no máximo {MAX_TABLE} cores @msg command `{0}` is not available right now: {1} o comando `{0}` não está disponível agora: {1} diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index d1593508d3..c48ae485d4 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -788,6 +788,8 @@ font-technology Variable Вариативные Delete Artboard Удалить монтажную область Delete Artboards Удалить монтажные области Delete Brush Удалить кисть + Delete Color Удалить цвет + Restore Generated Table Восстановить созданную таблицу Delete Character Style Удалить стиль символа Delete Empty Artboards Удалить пустые монтажные области Delete Freeform Point Удалить произвольную точку @@ -4975,6 +4977,7 @@ liquify-list-end {0}, {1} {0} и {1} @msg choose a folder to export to выберите папку для экспорта @msg choose a location for the package выберите расположение для пакета @msg clipboard is empty буфер обмена пуст +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: в цветовой таблице должен остаться хотя бы один цвет @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` не является цветом, например "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: не более {MAX_TABLE} цветов @msg command `{0}` is not available right now: {1} команда `{0}` сейчас недоступна: {1} diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 5c0420fcd3..f615d40d68 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -777,6 +777,8 @@ font-technology Variable Variabla Delete Artboard Radera rityta Delete Artboards Radera ritytor Delete Brush Radera pensel + Delete Color Radera färg + Restore Generated Table Återställ genererad tabell Delete Character Style Radera teckenstil Delete Empty Artboards Radera tomma ritytor Delete Freeform Point Radera fri punkt @@ -4848,6 +4850,7 @@ liquify-list-end {0}, {1} {0} och {1} @msg choose a folder to export to välj en mapp att exportera till @msg choose a location for the package välj en plats för paketet @msg clipboard is empty urklippet är tomt +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: minst en färg måste finnas kvar i färgtabellen @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` är inte en färg som "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: högst {MAX_TABLE} färger @msg command `{0}` is not available right now: {1} kommandot `{0}` är inte tillgängligt just nu: {1} diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 910a7fc5b1..4f0d6c6894 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -769,6 +769,8 @@ font-technology Variable Değişken Delete Artboard Çalışma Yüzeyini Sil Delete Artboards Çalışma Yüzeylerini Sil Delete Brush Fırçayı Sil + Delete Color Rengi Sil + Restore Generated Table Oluşturulan Tabloyu Geri Yükle Delete Character Style Karakter Stilini Sil Delete Empty Artboards Boş Çalışma Yüzeylerini Sil Delete Freeform Point Serbest Biçim Noktasını Sil @@ -4661,6 +4663,7 @@ liquify-list-end {0}, {1} {0} ve {1} @msg choose a folder to export to dışa aktarılacak bir klasör seçin @msg choose a location for the package paket için bir yer seçin @msg clipboard is empty pano boş +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: renk tablosunda en az bir renk kalmalı @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}`, "#ff8800" gibi bir renk değil @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: en fazla {MAX_TABLE} renginde @msg command `{0}` is not available right now: {1} `{0}` komutu şu anda kullanılamıyor: {1} diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index dbd6d2609e..fc4b4e9725 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -786,6 +786,8 @@ font-technology Variable Варіативні Delete Artboard Видалити монтажну область Delete Artboards Видалити монтажні області Delete Brush Видалити пензель + Delete Color Видалити колір + Restore Generated Table Відновити створену таблицю Delete Character Style Видалити стиль символу Delete Empty Artboards Видалити порожні монтажні області Delete Freeform Point Видалити довільну точку @@ -4965,6 +4967,7 @@ liquify-list-end {0}, {1} {0} і {1} @msg choose a folder to export to виберіть папку для експорту @msg choose a location for the package виберіть розташування для пакета @msg clipboard is empty буфер обміну порожній +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: у колірній таблиці має залишитися принаймні один колір @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` не є кольором, наприклад "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: не більше {MAX_TABLE} кольорів @msg command `{0}` is not available right now: {1} команда `{0}` зараз недоступна: {1} diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 519c5d8f0d..0739521496 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -915,6 +915,8 @@ font-technology Variable Biến thiên Delete Artboard Xóa bảng vẽ Delete Artboards Xóa các bảng vẽ Delete Brush Xóa cọ + Delete Color Xóa màu + Restore Generated Table Khôi phục bảng đã tạo Delete Character Style Xóa kiểu ký tự Delete Data Set Xóa tập dữ liệu Delete Design Xóa thiết kế @@ -5007,6 +5009,7 @@ theme Appearance Giao diện @msg choose the font files to add hãy chọn các tệp phông chữ để thêm @msg clipboard is empty khay nhớ tạm trống @msg closing needs three anchors đóng đường dẫn cần ba điểm neo +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: phải giữ lại ít nhất một màu trong bảng màu @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` không phải là màu như "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: tối đa {MAX_TABLE} màu @msg column must be true or a number from 1 column phải là true hoặc số từ 1 diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index c6696a9ec6..e9c3117ff4 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -734,6 +734,8 @@ antiAlias Sharp 锐利 Delete Artboard 删除画板 Delete Artboards 删除画板 Delete Brush 删除画笔 + Delete Color 删除颜色 + Restore Generated Table 恢复生成的颜色表 Delete Character Style 删除字符样式 Delete Empty Artboards 删除空白画板 Delete Freeform Point 删除自由点 @@ -4659,6 +4661,7 @@ imageTrace Outline 轮廓 @msg Create Outlines: select text objects 创建轮廓:请选择文本对象 @msg paste unavailable 无法粘贴 @msg Save for Web: the image is empty 存储为 Web 所用格式:图像为空 +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted:颜色表中至少要保留一种颜色 @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}:`{h}` 不是颜色,例如 "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}:最多 {MAX_TABLE} 种颜色 @msg no artboard {i} (0-based; the document has {_1}) 没有画板 {i} (从 0 开始计数;文档有 {_1} 个) diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 1480422931..992162d8c9 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -754,6 +754,8 @@ font-technology Variable 可變 Delete Artboard 刪除工作區域 Delete Artboards 刪除工作區域 Delete Brush 刪除筆刷 + Delete Color 刪除顏色 + Restore Generated Table 還原產生的色彩表 Delete Character Style 刪除字元樣式 Delete Empty Artboards 刪除空白工作區域 Delete Freeform Point 刪除任意形狀錨點 @@ -2192,6 +2194,7 @@ file-filter Templates 範本 @msg Create Outlines: select text objects 建立外框:請選取文字物件 @msg paste unavailable 無法貼上 @msg Save for Web: the image is empty 儲存為網頁用:影像是空的 +@msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted:色彩表中至少要保留一種顏色 @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}:`{h}` 不是像 "#ff8800" 這樣的顏色 @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}:最多 {MAX_TABLE} 種顏色 @msg no artboard {i} (0-based; the document has {_1}) 沒有工作區域 {i} (從 0 起算;文件有 {_1} 個) diff --git a/docs/mcp.md b/docs/mcp.md index 9416a81642..a1fbd84632 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -9005,7 +9005,7 @@ File → Export → Save for Web (Legacy) writes optimised web images: `document …}` renders the artboard (`clipToArtboard`, the default; `artboard` picks one) or the visible art and the slices, at `width`, `height` or `percent`, and encodes it with the format's settings: for GIF and PNG-8 `reduction`, `colors`, `dither`, `ditherAmount`, `transparency`, `matte`, `interlaced`, `webSnap`, `lossy` (GIF) and `colorTable {locked, -transparent, webShift, sort}`; for JPEG `quality`, `progressive`, `optimized`, `embedProfile` and `matte`; for PNG-24 +transparent, webShift, sort, deleted, customPalette}`; for JPEG `quality`, `progressive`, `optimized`, `embedProfile` and `matte`; for PNG-24 `transparency`, `matte` and `interlaced`. `metadata` (none, copyright, contact, all) writes File Info as PNG text or a GIF/JPEG comment; `convertToSrgb` marks PNGs as sRGB. `` is the name of `path` without its extension, or without `path` the document's title with the characters Windows does not allow in a file name as `-` and a `-` after @@ -9022,6 +9022,25 @@ file size), `seconds` to download at `kbps` (default 56.6), the size, and for pa `source` (the colour the reduction made), so a colour keeps its edits when it is web-shifted or snapped. `slice: n` previews one slice; `image: true` adds the file; `warnings` holds the export's warnings. +Delete Color is `colorTable.deleted: ["#rrggbb"…]`, by `source`. The deleted colors leave the table and the file, and +their pixels take the nearest color left, with the current reduction's color distance and dither; the preview and the +file agree. A deleted color also leaves `locked`, `transparent` and `webShift`. A color the table does not hold is +ignored. Deleting every opaque color is an error, and the settings, preview and files do not change; the transparent +entry of transparent pixels cannot be deleted. `colorTable.customPalette: ["#rrggbb"…]` is a fixed palette (a Custom +table) used instead of the reduction's own, at most `colors` entries with the transparent one included, so a color it +lacks is not made again; the dialog's Delete Color sets it to the table's colors on the first deletion. Both lists hold +at most 256 colors, and `#rrggbbaa` is refused. A `reduction` change without `colorTable` in the same params clears +both lists. JPEG and PNG-24 have no color table and do not read them. Presets and `webExport.settings` keep them. In +the dialog a click selects one color, Shift-click selects the colors between it and the last one clicked, and +Ctrl-click (Command-click on macOS) adds or removes one (`__colors` holds the selection, `__color` the last one +clicked). The trash button and Delete Color in the table's menu delete the selection in one edit, Restore Generated +Table in that menu clears `deleted` and `customPalette`, and the table reads Custom while either is set. Choosing +another reduction in the dialog also clears them. + +```json +{"name":"run_command","arguments":{"command":"document.exportForWeb.preview","params":{"format":"png8","colorTable":{"deleted":["#ff0000"],"customPalette":["#0000ff","#00ff00","#ff0000"]}}}} +``` + Optimize to File Size (the dialog's button under Preset) is `webExport.optimizeToFileSize {desiredK, startWith?, use?, slice?, …settings}`. It searches for settings whose files fit in `desiredK` K (1 K is 1024 bytes; above 0, at most 1048576) and returns them without writing a file or changing the remembered settings: `{targetBytes, achieved, diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b824eaae00..7d1a36d3f2 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -893,6 +893,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Save for Web: Preview in Browser writes each preview's page and images to a folder of its own inside `VectorCraft Save for Web` in the system's temporary folder. A later preview, from the same app or another one running, does not overwrite an earlier one. Each preview first removes the preview folders there that are an hour old or older and, on Linux, macOS and FreeBSD, belong to the current user; it leaves other files and folders alone. The folders a preview makes there are open to their owner only on those systems. When `VectorCraft Save for Web` is a link or is not a folder, or on those systems belongs to another user or can be written by other users, the preview goes to a new folder of its own in the temporary folder, which a later preview removes once it is an hour old (`file.saveForWeb.browser`). - Save for Web: Optimize to File Size… opens rows for a desired file size in K, Start With (Current Settings, Auto Select GIF/JPEG) and, with slices, Use (Total of All Slices, Each Slice, Current Slice); OK takes the settings whose files fit and shows the size found, or says that no setting tried fits ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=395)). The search lowers JPEG quality or palette colors (GIF then lossy) and encodes at most 32 trial settings; Auto Select chooses GIF for transparent art or art of at most 256 colors and JPEG otherwise. The slices share one setting, so every Use choice changes all of them (`webExport.optimizeToFileSize`). Scores and estimates are unchanged. - Save for Web: while Alt (Option on macOS) is held, the dialog's Cancel button reads Reset, which puts the remembered settings back on the document's active artboard and leaves the dialog open (`ui.dialogReset`). + - Save for Web: the color table's trash button and Delete Color in its menu remove the selected GIF or PNG-8 colors, and their pixels take the nearest color left in the palette ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=404)). Click selects one color, Shift-click a range and Ctrl-click (Command-click on macOS) adds or removes one ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=398)). After the first deletion the table is a fixed Custom palette, so deleted colors stay out when the preview updates. These rules are VectorCraft's own: a deleted color is no longer locked, transparent or web-shifted; deleting every opaque color is refused; Restore Generated Table in the menu, or another reduction, goes back to the generated palette; presets and the remembered settings keep the edit (`colorTable.deleted`, `colorTable.customPalette`). Fixed palettes can also use all 256 entries when nothing is transparent. Scores and estimates are unchanged. - Export for Screens, Save for Web (slice images, and files named after the document's title) and the Libraries panel name files with the characters Windows does not allow written as `-` and with a `-` after a Windows device name such as `CON`, on every platform (`document.exportForScreens`, `document.exportForWeb`, `library.create`). - Variables (data merge): text, visibility and image variables bound to objects (an object may carry several), dataset rows applied in one undo step (`variable.*`, `dataset.*`) from a Variables panel and Window › Variables, with dialogs to define, bind and edit, Make Text/Visibility/Image Dynamic, Capture/Update Data Set, CSV import/export (`dataset.import` / `dataset.export`), and a row in italics when an edit leaves the art not matching it; an image dataset value is a file path and apply keeps the object's bounds; bindings let go of deleted art and locked art is left alone except by visibility values; every command, like the rest, is drivable over MCP and the CLI. - Export for Screens numbers distinct row files whose names collide, compared without case, as `-2`, `-3`… instead of leaving them out; identical rows still write one file. It puts row folders that differ only in case into one folder (`document.exportForScreens`).