diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 152c1c5462..e2b6c7132e 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1397,6 +1397,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{} switch the Color panel's R, G and B between percent and 0 to 255, as a double-click right of an RGB field does (ui.colorPanel {rgbPercent}); the color does not change, and the choice is kept with the preferences; a parameter is an error and changes nothing → true when they show in percent", ), + ( + "ui.colorWheel", + "Color Wheel Options", + "", + "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue} show the Color Wheel panel's wheel or its box, as the panel menu's Wheel View and Box View do, and pick the box's channel, as Box Channel does: the box is a color field with the channel's strip at its right, and the field shows the other two components (hue: saturation across and brightness up; saturation: hue across and brightness up; brightness: hue across and saturation up; red: blue across and green up; green: blue across and red up; blue: red across and green up); keys left out keep their values, params that are not an object, another key or a value off the list are an error and change nothing, both are kept with the preferences, and the command does not open the panel (window.panel {panel: \"colorWheel\"} does) (ui.inspect: ui.color_wheel) → {view, channel}", + ), ( "ui.savePdfDialog", "Save PDF Dialog", diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 38dbf3eb4e..0f09f09cb2 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -25,7 +25,7 @@ pub mod char_style_options; pub mod check_spelling; pub mod color_balance; pub mod color_guide_options; -mod color_picker; +pub(crate) mod color_picker; mod command; pub mod composite_fonts; pub mod confirm; diff --git a/crates/ui-egui/src/dialogs/color_picker.rs b/crates/ui-egui/src/dialogs/color_picker.rs index 0bd287cc31..bb3a5633ed 100644 --- a/crates/ui-egui/src/dialogs/color_picker.rs +++ b/crates/ui-egui/src/dialogs/color_picker.rs @@ -103,11 +103,22 @@ impl Channel { Channel::Green => "G", } } - fn is_hsb(self) -> bool { + /// The channel's name, translated: Hue, Saturation, Brightness, Red, Green or Blue. + pub(crate) fn name(self) -> &'static str { + match self { + Channel::Hue => tl!("Hue"), + Channel::Saturation => tl!("Saturation"), + Channel::Brightness => tl!("Brightness"), + Channel::Red => tl!("Red"), + Channel::Green => tl!("Green"), + Channel::Blue => tl!("Blue"), + } + } + pub(crate) fn is_hsb(self) -> bool { matches!(self, Channel::Hue | Channel::Saturation | Channel::Brightness) } /// Indices of (slider, field x, field y) into the channel's space: [h, s, b] or [r, g, b]. - fn axes(self) -> (usize, usize, usize) { + pub(crate) fn axes(self) -> (usize, usize, usize) { match self { Channel::Hue => (0, 1, 2), Channel::Saturation => (1, 0, 2), @@ -119,7 +130,7 @@ impl Channel { } /// The color field's axes (across, up) as keys and screen readers see them: hue in degrees, /// saturation and brightness in percent, red, green and blue from 0 to 255. - fn field_axes(self) -> [widgets::FieldAxis<'static>; 2] { + pub(crate) fn field_axes(self) -> [widgets::FieldAxis<'static>; 2] { let axis = |i: usize| { let (name, units, suffix) = match (self.is_hsb(), i) { (true, 0) => (tl!("Hue"), 360.0, "°"), @@ -406,10 +417,19 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> DialogAction { let track = |z: f32| c32(&Picked::of(slider_color(channel, z, x, y)).snapped(web).color); let (v, suffix, max) = channel_value(channel, &p); let shown = widgets::SliderValue::field(v as f64, 0.0..=max as f64, suffix, 0); - if let (Some(z), _) = - widgets::channel_slider_valued(ui, "cp-slider", tl!(channel.label()), Some(shown), z, vec2(SLIDER_W, side), &track) - { - pick = Some(field_pick(channel, z, x, y)); + match widgets::channel_slider_stepped( + ui, + "cp-slider", + tl!(channel.label()), + Some(shown), + z, + true, + vec2(SLIDER_W, side), + &track, + ) { + (Some(z), ..) => pick = Some(field_pick(channel, z, x, y)), + (None, _, Some(v)) => pick = Some(field_pick(channel, (v / max as f64) as f32, x, y)), + _ => {} } }); } diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index eb95d21db1..d5949c571d 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -562,6 +562,11 @@ font-technology Variable Променливи Saturation and brightness Насищане и яркост Color field Цветово поле {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Изглед „Колело“ + Box View Изглед „Квадрат“ + Box Channel Канал на квадрата + Color box Цветови квадрат + Color Wheel Options Опции на цветното колело Color Type: Цветен тип: Color: Цвят: Colorize Оцветяване diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 435ee0683b..78350e02b3 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -756,6 +756,11 @@ Saturation and brightness Zasićenje i svjetlina Color field Polje boje {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Prikaz kotača + Box View Prikaz kvadrata + Box Channel Kanal kvadrata + Color box Kvadrat boje + Color Wheel Options Opcije kotača boja CSS Properties CSS svojstva Document Info Informacije o dokumentu Flattener Preview Pregled spljoštavanja @@ -4921,6 +4926,8 @@ imageTrace Outline Obris @msg `{min_key}` is greater than `{max_key}` `{min_key}` je veće od `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` navedite barem jedno od `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` mora biti grayscale, rgb, hsb, cmyk ili websafe +@msg `view` must be wheel or box `view` mora biti wheel ili box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` mora biti hue, saturation, brightness, red, green ili blue @msg `{k}` must be [x, y] `{k}` mora biti [x, y] @msg `{name}` has no options `{name}` nema opcija @msg `{name}` is a built-in workspace; choose another name `{name}` je ugrađeni radni prostor; odaberite drugi naziv diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 638fa9a01d..0fc01f777b 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -829,6 +829,11 @@ antiAlias Sharp Nítid Saturation and brightness Saturació i lluentor Color field Camp de color {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Visualització de roda + Box View Visualització de quadre + Box Channel Canal del quadre + Color box Quadre de color + Color Wheel Options Opcions de la roda de colors Color Type: Tipus de color: Color wheel Roda de color Color: Color: @@ -5594,6 +5599,8 @@ digits Malayalam Malaiàlam @msg a negative `aspect` applies to conic gradients un `aspect` negatiu s’aplica als degradats cònics @msg `focal` applies to radial gradients `focal` s’aplica als degradats radials @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` ha de ser grayscale, rgb, hsb, cmyk o websafe +@msg `view` must be wheel or box `view` ha de ser wheel o box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` ha de ser hue, saturation, brightness, red, green o blue @msg `name` is empty `name` és buit @msg `newName` is empty `newName` és buit @msg `pathfinder` must be an object `pathfinder` ha de ser un objecte diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 4e24be7305..9223cf0b12 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -767,6 +767,11 @@ Saturation and brightness Sytost a jas Color field Barevné pole {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Zobrazení kola + Box View Zobrazení čtverce + Box Channel Kanál čtverce + Color box Barevný čtverec + Color Wheel Options Možnosti barevného kola CSS Properties Vlastnosti CSS Document Info Informace o dokumentu Flattener Preview Náhled sloučení @@ -5180,6 +5185,8 @@ liquify-list-end {0}, {1} {0} a {1} @msg `{min_key}` is greater than `{max_key}` `{min_key}` je větší než `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` zadejte alespoň jeden z parametrů `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` musí být grayscale, rgb, hsb, cmyk nebo websafe +@msg `view` must be wheel or box `view` musí být wheel nebo box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` musí být hue, saturation, brightness, red, green nebo blue @msg `{k}` must be [x, y] `{k}` musí být [x, y] @msg `{name}` has no options `{name}` nemá žádné možnosti @msg `{name}` is a built-in workspace; choose another name `{name}` je vestavěný pracovní prostor; zvolte jiný název diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 14909108c5..f1281c1c4f 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -3416,6 +3416,11 @@ liquify-list-end {0}, {1} {0} og {1} Saturation and brightness Mætning og lysstyrke Color field Farvefelt {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Hjulvisning + Box View Kvadratvisning + Box Channel Kvadratets kanal + Color box Farvekvadrat + Color Wheel Options Indstillinger for farvehjul CSS Properties CSS-egenskaber Document Info Dokumentoplysninger Flattener Preview Udjævningsforhåndsvisning @@ -8681,6 +8686,8 @@ mark-style Japanese Japansk @msg the file's variable library couldn't be read: the Variables panel doesn't list it filens variabelbibliotek kunne ikke læses: variabelpanelet viser det ikke @msg a variable of unknown kind can't be bound to objects en variabel af ukendt type kan ikke bindes til objekter @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` skal være grayscale, rgb, hsb, cmyk eller websafe +@msg `view` must be wheel or box `view` skal være wheel eller box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` skal være hue, saturation, brightness, red, green eller blue @msg the Color Picker is not open farvevælgeren er ikke åben @msg the screen color sampler is already open skærmfarvesampleren er allerede åben @msg this system has no screen color sampler dette system har ingen skærmfarvesampler diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index e3934c9162..d0f33e6707 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -557,6 +557,11 @@ font-technology Variable Variabel Saturation and brightness Sättigung und Helligkeit Color field Farbauswahlfeld {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Kreisansicht + Box View Quadratansicht + Box Channel Kanal des Quadrats + Color box Farbquadrat + Color Wheel Options Optionen für den Farbkreis Color Type: Farbart: Color: Farbe: Colorize Einfärben @@ -4780,6 +4785,8 @@ liquify-list-end {0}, {1} {0} und {1} @msg `{min_key}` is greater than `{max_key}` `{min_key}` ist größer als `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` geben Sie mindestens einen der Parameter `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` an @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` muss grayscale, rgb, hsb, cmyk oder websafe sein +@msg `view` must be wheel or box `view` muss wheel oder box sein +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` muss hue, saturation, brightness, red, green oder blue sein @msg `{k}` must be [x, y] `{k}` muss [x, y] sein @msg `{name}` has no options `{name}` hat keine Optionen @msg `{name}` is a built-in workspace; choose another name `{name}` ist ein integrierter Arbeitsbereich; wählen Sie einen anderen Namen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index be33c1dd48..5cd41b75ff 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -537,6 +537,11 @@ font-technology Variable Μεταβλητές Saturation and brightness Κορεσμός και φωτεινότητα Color field Πεδίο χρώματος {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Προβολή τροχού + Box View Προβολή τετραγώνου + Box Channel Κανάλι τετραγώνου + Color box Τετράγωνο χρώματος + Color Wheel Options Επιλογές χρωματικού τροχού Color Type: Τύπος χρώματος: Color: Χρώμα: Colorize Χρωματισμός @@ -6546,6 +6551,8 @@ effect Points Σημεία @msg Unknown dimension option {k} Άγνωστη επιλογή διάστασης {k} @msg Unknown dimension orientation Άγνωστος προσανατολισμός διάστασης @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe το `mode` πρέπει να είναι grayscale, rgb, hsb, cmyk ή websafe +@msg `view` must be wheel or box το `view` πρέπει να είναι wheel ή box +@msg `channel` must be hue, saturation, brightness, red, green or blue το `channel` πρέπει να είναι hue, saturation, brightness, red, green ή blue @msg `{key}` must be an array of these names: {_1} το `{key}` πρέπει να είναι πίνακας με αυτά τα ονόματα: {_1} @msg choose a destination folder επιλέξτε φάκελο προορισμού @msg choose a source folder επιλέξτε φάκελο προέλευσης diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 38b031471a..c48f2ab950 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -577,6 +577,11 @@ font-technology Variable Variables Saturation and brightness Saturación y brillo Color field Campo de color {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Vista de rueda + Box View Vista de cuadro + Box Channel Canal del cuadro + Color box Cuadro de color + Color Wheel Options Opciones de la rueda de color Color Type: Tipo de color: Color: Color: Colorize Colorear @@ -4884,6 +4889,8 @@ liquify-list-end {0}, {1} {0}, {1} @msg `{min_key}` is greater than `{max_key}` `{min_key}` es mayor que `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` indica al menos uno de `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` debe ser grayscale, rgb, hsb, cmyk o websafe +@msg `view` must be wheel or box `view` debe ser wheel o box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` debe ser hue, saturation, brightness, red, green o blue @msg `{k}` must be [x, y] `{k}` debe ser [x, y] @msg `{name}` has no options `{name}` no tiene opciones @msg `{name}` is a built-in workspace; choose another name `{name}` es un espacio de trabajo integrado; elige otro nombre diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index c33e809e2a..5d0c423111 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -758,6 +758,11 @@ Saturation and brightness Kylläisyys ja kirkkaus Color field Värikenttä {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Ympyränäkymä + Box View Ruutunäkymä + Box Channel Ruudun kanava + Color box Väriruutu + Color Wheel Options Väriympyrän asetukset CSS Properties CSS-ominaisuudet Document Info Asiakirjan tiedot Flattener Preview Litistyksen esikatselu @@ -6556,6 +6561,8 @@ mark-style Japanese Japanilainen @msg Unknown dimension option {k} Tuntematon mitoitusasetus {k} @msg Unknown dimension orientation Tuntematon mitan suunta @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode`-arvon on oltava grayscale, rgb, hsb, cmyk tai websafe +@msg `view` must be wheel or box `view`-arvon on oltava wheel tai box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel`-arvon on oltava hue, saturation, brightness, red, green tai blue @msg `{key}` must be an array of these names: {_1} `{key}`-arvon on oltava taulukko, jossa on näitä nimiä: {_1} @msg choose a destination folder valitse kohdekansio @msg choose a source folder valitse lähdekansio diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index fffd46a40b..2ba87e52ab 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -578,6 +578,11 @@ font-technology Variable Variables Saturation and brightness Saturation et luminosité Color field Champ de couleur {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Affichage roue + Box View Affichage carré + Box Channel Couche du carré + Color box Carré de couleur + Color Wheel Options Options de la roue chromatique Color Type: Type de couleur : Color: Couleur : Colorize Coloriser @@ -4846,6 +4851,8 @@ liquify-list-end {0}, {1} {0} et {1} @msg `{min_key}` is greater than `{max_key}` `{min_key}` est supérieur à `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` indiquez au moins l’un des paramètres `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` doit valoir grayscale, rgb, hsb, cmyk ou websafe +@msg `view` must be wheel or box `view` doit valoir wheel ou box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` doit valoir hue, saturation, brightness, red, green ou blue @msg `{k}` must be [x, y] `{k}` doit être [x, y] @msg `{name}` has no options `{name}` n’a pas d’options @msg `{name}` is a built-in workspace; choose another name `{name}` est un espace de travail intégré ; choisissez un autre nom diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 80bbff691b..52789183fb 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -4521,6 +4521,11 @@ {kind} Gradient {kind} ગ્રેડિયન્ટ {kind}, {model} {kind}, {model} {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View વ્હીલ વ્યૂ + Box View બૉક્સ વ્યૂ + Box Channel બૉક્સ ચેનલ + Color box રંગ બૉક્સ + Color Wheel Options રંગ વ્હીલ વિકલ્પો {name} (spot) {name} (સ્પૉટ) {pages} in all, {count} per copy કુલ {pages}, પ્રતિ નકલ {count} {page} of {count} {count} માંથી {page} diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index b37c39d584..fe6c223c1c 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -961,6 +961,11 @@ antiAlias Sharp शार्प Saturation and brightness सैचुरेशन और ब्राइटनेस Color field कलर फ़ील्ड {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View व्हील व्यू + Box View बॉक्स व्यू + Box Channel बॉक्स चैनल + Color box कलर बॉक्स + Color Wheel Options कलर व्हील ऑप्शन्स Color Type: रंग का प्रकार: Color wheel कलर व्हील Color: रंग: @@ -6505,6 +6510,8 @@ antiAlias Sharp शार्प @msg `mode` must be "handles", "straight" or "smooth" `mode` को "handles", "straight" या "smooth" होना चाहिए @msg `mode` must be "straight", "bezier" or "arc" `mode` को "straight", "bezier" या "arc" होना चाहिए @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` को grayscale, rgb, hsb, cmyk या websafe होना चाहिए +@msg `view` must be wheel or box `view` को wheel या box होना चाहिए +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` को hue, saturation, brightness, red, green या blue होना चाहिए @msg `mode` must be one of {_1} `mode` को {_1} में से एक होना चाहिए @msg `mojikumi` must be "none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku" or "lineEndHalf" `mojikumi` "none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku" या "lineEndHalf" होना चाहिए। @msg `name` is empty `name` खाली है diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 9537655bf9..17ae7b7214 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -758,6 +758,11 @@ font-technology Variable Változó Saturation and brightness Telítettség és fényesség Color field Színmező {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Körnézet + Box View Négyzetnézet + Box Channel Négyzet csatornája + Color box Színnégyzet + Color Wheel Options Színkör beállításai Color Type: Színtípus: Color: Szín: Colorization Színezés @@ -5239,6 +5244,8 @@ imageTrace Outline Körvonal @msg `{min_key}` is greater than `{max_key}` `{min_key}` nagyobb, mint `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` adj meg legalább egyet ezek közül: `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode`: grayscale, rgb, hsb, cmyk vagy websafe kell +@msg `view` must be wheel or box `view`: wheel vagy box kell +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel`: hue, saturation, brightness, red, green vagy blue kell @msg `{k}` must be [x, y] `{k}`: [x, y] kell @msg `{name}` has no options ennek nincsenek beállításai: `{name}` @msg `{name}` is a built-in workspace; choose another name beépített munkaterület: `{name}`; válassz másik nevet diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index d7effedaa4..c1257e6c8d 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -714,6 +714,11 @@ Saturation and brightness Saturasi dan kecerahan Color field Kolom warna {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Tampilan roda + Box View Tampilan kotak + Box Channel Saluran kotak + Color box Kotak warna + Color Wheel Options Opsi roda warna CSS Properties Properti CSS Document Info Info dokumen Flattener Preview Pratinjau perata @@ -5917,6 +5922,8 @@ mark-style Japanese Jepang @msg the file's variable library couldn't be read: the Variables panel doesn't list it pustaka variabel file tidak dapat dibaca: panel Variabel tidak menampilkannya @msg a variable of unknown kind can't be bound to objects variabel bertipe tidak dikenal tidak dapat diikat ke objek @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` harus grayscale, rgb, hsb, cmyk atau websafe +@msg `view` must be wheel or box `view` harus wheel atau box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` harus hue, saturation, brightness, red, green atau blue @msg the Color Picker is not open Pemilih Warna tidak terbuka @msg the screen color sampler is already open pengambil warna layar sudah terbuka @msg this system has no screen color sampler sistem ini tidak memiliki pengambil warna layar diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 9ccac81cdb..8ebf43ce5d 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -579,6 +579,11 @@ font-technology Variable Variabili Saturation and brightness Saturazione e luminosità Color field Campo colore {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Vista ruota + Box View Vista riquadro + Box Channel Canale del riquadro + Color box Riquadro colore + Color Wheel Options Opzioni ruota dei colori Color Type: Tipo di colore: Color: Colore: Colorize Colora @@ -4914,6 +4919,8 @@ liquify-list-end {0}, {1} {0} e {1} @msg `{min_key}` is greater than `{max_key}` `{min_key}` è maggiore di `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` indica almeno uno tra `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` deve essere grayscale, rgb, hsb, cmyk o websafe +@msg `view` must be wheel or box `view` deve essere wheel o box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` deve essere hue, saturation, brightness, red, green o blue @msg `{k}` must be [x, y] `{k}` deve essere [x, y] @msg `{name}` has no options `{name}` non ha opzioni @msg `{name}` is a built-in workspace; choose another name `{name}` è un'area di lavoro integrata; scegli un altro nome diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index f77564e19d..4969023e94 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -792,6 +792,11 @@ digits Malayalam マラヤーラム数字 Saturation and brightness 彩度と明るさ Color field カラーフィールド {name1} {value1}, {name2} {value2} {name1} {value1}、{name2} {value2} + Wheel View ホイール表示 + Box View ボックス表示 + Box Channel ボックスのチャンネル + Color box カラーボックス + Color Wheel Options カラーホイールオプション CSS Properties CSS プロパティ Document Info ドキュメント情報 Flattener Preview 分割・統合プレビュー @@ -5331,6 +5336,8 @@ swatch Bright Violet ビビッドバイオレット @msg No saved views (View → New View…) 保存した表示はありません (表示 → 新規表示…) @msg `command` must be a command whose menu item opens a dialog (see ui.menuDialog) `command` には、メニュー項目がダイアログを開くコマンドを指定してください (ui.menuDialog を参照) @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` には grayscale、rgb、hsb、cmyk、websafe のいずれかを指定してください +@msg `view` must be wheel or box `view` には wheel、box のいずれかを指定してください +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` には hue、saturation、brightness、red、green、blue のいずれかを指定してください @msg `{key}` must be true or false `{key}` には true または false を指定してください @msg `top` and `below` can't both be true `top` と `below` を同時に true にすることはできません @msg `select` must be true or false `select` には true または false を指定してください diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 9c393c6868..20ca26d39d 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -2879,6 +2879,11 @@ Saturation and brightness გაჯერება და სიკაშკაშე Color field ფერის ველი {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View წრის ხედი + Box View კვადრატის ხედი + Box Channel კვადრატის არხი + Color box ფერის კვადრატი + Color Wheel Options ფერთა წრის პარამეტრები CSS Properties CSS თვისებები Document Info დოკუმენტის ინფორმაცია Flattener Preview გაბრტყელების წინასწარი ნახვა @@ -8389,6 +8394,8 @@ liquify-list-end {0}, {1} {0} და {1} Color Panel Options ფერის პანელის პარამეტრები @msg `{key}` must be an array of these names: {_1} `{key}` უნდა იყოს ამ სახელების მასივი: {_1} @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` უნდა იყოს grayscale, rgb, hsb, cmyk ან websafe +@msg `view` must be wheel or box `view` უნდა იყოს wheel ან box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` უნდა იყოს hue, saturation, brightness, red, green ან blue @msg this is a PostScript file (an .ai saved in an older format or without PDF compatibility, or an EPS file), not a PDF: File › Open and File › Place read it as EPS ეს PostScript ფაილია (ძველ ფორმატში ან PDF-თან თავსებადობის გარეშე შენახული .ai, ან EPS ფაილი) და არა PDF: ფაილი › გახსნა და ფაილი › განთავსება მას EPS-ად კითხულობს # Upstream sync 2026-10-16 (3): Intertwine, symbol registration, gradient span, data sets, Batch. Intertwine გადახლართვა diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index a253214c7d..b188b2390e 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -785,6 +785,11 @@ digits Malayalam 말라얄람어 Saturation and brightness 채도 및 밝기 Color field 색상 필드 {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View 휠 보기 + Box View 상자 보기 + Box Channel 상자 채널 + Color box 색상 상자 + Color Wheel Options 색상환 옵션 CSS Properties CSS 속성 Document Info 문서 정보 Flattener Preview 병합 미리 보기 @@ -5258,6 +5263,8 @@ theme Appearance 외관 @msg No saved views (View → New View…) 저장된 보기가 없습니다(보기 → 새 보기…) @msg `command` must be a command whose menu item opens a dialog (see ui.menuDialog) `command`는 메뉴 항목이 대화상자를 여는 명령이어야 합니다(ui.menuDialog 참조) @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode`은(는) grayscale, rgb, hsb, cmyk, websafe 중 하나여야 합니다 +@msg `view` must be wheel or box `view`은(는) wheel, box 중 하나여야 합니다 +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel`은(는) hue, saturation, brightness, red, green, blue 중 하나여야 합니다 @msg `{key}` must be true or false `{key}`은(는) true 또는 false여야 합니다 @msg `top` and `below` can't both be true `top`과 `below`를 동시에 true로 지정할 수 없습니다 @msg `select` must be true or false `select`은(는) true 또는 false여야 합니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 760b4d5729..42634fef64 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1287,6 +1287,11 @@ liquify-list-end {0}, {1} {0} en {1} Saturation and brightness Verzadiging en helderheid Color field Kleurveld {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Wielweergave + Box View Vakweergave + Box Channel Kanaal van het vak + Color box Kleurvak + Color Wheel Options Opties voor kleurenwiel CSS Properties CSS-eigenschappen Document Info Documentinfo Flattener Preview Afvlakvoorbeeld @@ -8463,6 +8468,8 @@ mark-style Japanese Japans @msg the file's variable library couldn't be read: the Variables panel doesn't list it de variabelenbibliotheek van het bestand kan niet worden ingelezen: het Variabelen-paneel toont die niet @msg a variable of unknown kind can't be bound to objects een variabele van onbekend type kan niet aan objecten worden gekoppeld @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` moet grayscale, rgb, hsb, cmyk of websafe zijn +@msg `view` must be wheel or box `view` moet wheel of box zijn +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` moet hue, saturation, brightness, red, green of blue zijn @msg the Color Picker is not open de kleurenkiezer is niet open @msg the screen color sampler is already open de schermkleurkiezer is al open @msg this system has no screen color sampler dit systeem heeft geen schermkleurkiezer diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index aae6327cf7..c301ea515f 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -716,6 +716,11 @@ Saturation and brightness Nasycenie i jasność Color field Pole koloru {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Widok koła + Box View Widok kwadratu + Box Channel Kanał kwadratu + Color box Kwadrat koloru + Color Wheel Options Opcje koła kolorów CSS Properties Właściwości CSS Document Info Informacje o dokumencie Flattener Preview Podgląd spłaszczania @@ -5003,6 +5008,8 @@ liquify-list-end {0}, {1} {0} i {1} @msg `{min_key}` is greater than `{max_key}` `{min_key}` jest większe niż `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` podaj co najmniej jeden z parametrów `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` musi mieć wartość grayscale, rgb, hsb, cmyk lub websafe +@msg `view` must be wheel or box `view` musi mieć wartość wheel lub box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` musi mieć wartość hue, saturation, brightness, red, green lub blue @msg `{k}` must be [x, y] `{k}` musi mieć postać [x, y] @msg `{name}` has no options `{name}` nie ma opcji @msg `{name}` is a built-in workspace; choose another name `{name}` to wbudowany obszar roboczy; wybierz inną nazwę diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 8906e86813..fc2cc2c8a8 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -521,6 +521,11 @@ antiAlias Sharp Nítido Saturation and brightness Saturação e Brilho Color field Campo de Cor {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Exibição em Roda + Box View Exibição em Caixa + Box Channel Canal da Caixa + Color box Caixa de cor + Color Wheel Options Opções da Roda de Cores Color Type: Tipo de Cor: Color blindness – Deuteranopia-type Daltonismo – tipo deuteranopia Color blindness – Protanopia-type Daltonismo – tipo protanopia @@ -6511,6 +6516,8 @@ mark-style Japanese Japonesas two points, then move and click to place an aligned, horizontal or vertical dimension | em dois pontos, depois mova e clique para posicionar uma cota alinhada, horizontal ou vertical | Color Panel Options Opções do Painel Cor @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` deve ser grayscale, rgb, hsb, cmyk ou websafe +@msg `view` must be wheel or box `view` deve ser wheel ou box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` deve ser hue, saturation, brightness, red, green ou blue @msg the image can't be read as a texture a imagem não pode ser lida como textura # User Interface › Accent Color diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index ff871df842..5f14d4f9e4 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -575,6 +575,11 @@ font-technology Variable Вариативные Saturation and brightness Насыщенность и яркость Color field Цветовое поле {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Вид «Круг» + Box View Вид «Квадрат» + Box Channel Канал квадрата + Color box Цветовой квадрат + Color Wheel Options Параметры цветового круга Color Type: Тип цвета: Color: Цвет: Colorize Тонировать @@ -4908,6 +4913,8 @@ liquify-list-end {0}, {1} {0} и {1} @msg `{min_key}` is greater than `{max_key}` `{min_key}` больше, чем `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` укажите хотя бы один из параметров `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` должно быть grayscale, rgb, hsb, cmyk или websafe +@msg `view` must be wheel or box `view` должно быть wheel или box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` должно быть hue, saturation, brightness, red, green или blue @msg `{k}` must be [x, y] `{k}` должно быть [x, y] @msg `{name}` has no options `{name}` не имеет параметров @msg `{name}` is a built-in workspace; choose another name `{name}` — встроенная рабочая среда; выберите другое имя diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 0289b173e6..db8a332680 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -564,6 +564,11 @@ font-technology Variable Variabla Saturation and brightness Mättnad och ljusstyrka Color field Färgfält {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Hjulvy + Box View Rutvy + Box Channel Rutans kanal + Color box Färgruta + Color Wheel Options Alternativ för färghjulet Color Type: Färgtyp: Color: Färg: Colorize Färglägg @@ -6536,6 +6541,8 @@ theme Appearance Utseende @msg Unknown dimension option {k} Okänt måttalternativ {k} @msg Unknown dimension orientation Okänd måttriktning @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` måste vara grayscale, rgb, hsb, cmyk eller websafe +@msg `view` must be wheel or box `view` måste vara wheel eller box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` måste vara hue, saturation, brightness, red, green eller blue @msg `{key}` must be an array of these names: {_1} `{key}` måste vara en lista med dessa namn: {_1} @msg choose a destination folder välj en målmapp @msg choose a source folder välj en källmapp diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 3bfd2d8b61..6c552b2135 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -558,6 +558,11 @@ font-technology Variable Değişken Saturation and brightness Doygunluk ve parlaklık Color field Renk seçim alanı {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Tekerlek Görünümü + Box View Kutu Görünümü + Box Channel Kutu Kanalı + Color box Renk kutusu + Color Wheel Options Renk Tekerleği Seçenekleri Color Type: Renk Türü: Color: Renk: Colorize Renklendir @@ -4616,6 +4621,8 @@ liquify-list-end {0}, {1} {0} ve {1} @msg `{min_key}` is greater than `{max_key}` `{min_key}`, `{max_key}` değerinden büyük @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` şunlardan en az birini verin: `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` grayscale, rgb, hsb, cmyk veya websafe olmalıdır +@msg `view` must be wheel or box `view` wheel veya box olmalıdır +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` hue, saturation, brightness, red, green veya blue olmalıdır @msg `{k}` must be [x, y] `{k}` [x, y] olmalıdır @msg `{name}` has no options `{name}`nin seçeneği yok @msg `{name}` is a built-in workspace; choose another name `{name}` yerleşik bir çalışma alanıdır; başka bir isim seç diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index b4791c460f..b6dec0cc62 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -573,6 +573,11 @@ font-technology Variable Варіативні Saturation and brightness Насиченість і яскравість Color field Колірне поле {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Вигляд «Коло» + Box View Вигляд «Квадрат» + Box Channel Канал квадрата + Color box Колірний квадрат + Color Wheel Options Параметри колірного кола Color Type: Тип кольору: Color: Колір: Colorize Тонувати @@ -4898,6 +4903,8 @@ liquify-list-end {0}, {1} {0} і {1} @msg `{min_key}` is greater than `{max_key}` `{min_key}` більше за `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` укажіть принаймні один із параметрів `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` має бути grayscale, rgb, hsb, cmyk або websafe +@msg `view` must be wheel or box `view` має бути wheel або box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` має бути hue, saturation, brightness, red, green або blue @msg `{k}` must be [x, y] `{k}` має бути [x, y] @msg `{name}` has no options `{name}` не має параметрів @msg `{name}` is a built-in workspace; choose another name `{name}` - вбудоване робоче середовище; виберіть інше ім’я diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 7a99dd59a9..b38c274842 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -671,6 +671,11 @@ font-technology Variable Biến thiên Saturation and brightness Độ bão hòa và độ sáng Color field Vùng chọn màu {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + Wheel View Hiển thị bánh xe + Box View Hiển thị hộp + Box Channel Kênh của hộp + Color box Hộp màu + Color Wheel Options Tùy chọn bánh xe màu Color Type: Loại màu: Color: Màu: Colorization Tô màu @@ -4901,6 +4906,8 @@ theme Appearance Giao diện @msg `{min_key}` is greater than `{max_key}` `{min_key}` lớn hơn `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` hãy cung cấp ít nhất một trong `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` phải là grayscale, rgb, hsb, cmyk hoặc websafe +@msg `view` must be wheel or box `view` phải là wheel hoặc box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` phải là hue, saturation, brightness, red, green hoặc blue @msg `{k}` must be [x, y] `{k}` phải là [x, y] @msg `{name}` has no options `{name}` không có tùy chọn @msg `{name}` is a built-in workspace; choose another name `{name}` là không gian làm việc tích hợp sẵn; hãy chọn tên khác diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 7cadacf3ef..480d06c312 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -524,6 +524,11 @@ antiAlias Sharp 锐利 Saturation and brightness 饱和度和亮度 Color field 颜色区域 {name1} {value1}, {name2} {value2} {name1} {value1},{name2} {value2} + Wheel View 色轮视图 + Box View 方块视图 + Box Channel 方块色版 + Color box 颜色方块 + Color Wheel Options 色轮选项 Color Type: 颜色类型: Color: 颜色: Colorize 上色 @@ -5012,6 +5017,8 @@ imageTrace Outline 轮廓 @msg No saved views (View → New View…) 没有已保存的视图 (视图 → 新建视图…) @msg `command` must be a command whose menu item opens a dialog (see ui.menuDialog) `command` 必须是其菜单项会打开对话框的命令 (请参阅 ui.menuDialog) @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` 必须是 grayscale、rgb、hsb、cmyk 或 websafe +@msg `view` must be wheel or box `view` 必须是 wheel 或 box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` 必须是 hue、saturation、brightness、red、green 或 blue @msg `{key}` must be true or false `{key}` 必须是 true 或 false @msg `top` and `below` can't both be true `top` 和 `below` 不能同时为 true @msg `select` must be true or false `select` 必须是 true 或 false diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 2b9196ef8c..ae17f8afba 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -541,6 +541,11 @@ font-technology Variable 可變 Saturation and brightness 飽和度和亮度 Color field 顏色區域 {name1} {value1}, {name2} {value2} {name1} {value1},{name2} {value2} + Wheel View 色輪檢視 + Box View 方塊檢視 + Box Channel 方塊色版 + Color box 顏色方塊 + Color Wheel Options 色輪選項 Color Type: 顏色類型: Color: 顏色: Colorize 上色 @@ -2517,6 +2522,8 @@ file-filter Templates 範本 @msg No saved views (View → New View…) 沒有已儲存的檢視 (檢視 → 新增檢視…) @msg `command` must be a command whose menu item opens a dialog (see ui.menuDialog) `command` 必須是選單項目會開啟對話框的指令 (請參閱 ui.menuDialog) @msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` 必須是 grayscale、rgb、hsb、cmyk 或 websafe +@msg `view` must be wheel or box `view` 必須是 wheel 或 box +@msg `channel` must be hue, saturation, brightness, red, green or blue `channel` 必須是 hue、saturation、brightness、red、green 或 blue @msg `{key}` must be true or false `{key}` 必須是 true 或 false @msg `top` and `below` can't both be true `top` 和 `below` 不能同時為 true @msg `select` must be true or false `select` 必須是 true 或 false diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 704fb1ada3..71dd59f475 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -949,6 +949,7 @@ fn run_ui_part10(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option crate::panels::color_guide::set_limit(app, p), "ui.colorPanel" => crate::panels::color::command(app, p), "ui.colorRgbPercent" => crate::panels::color::rgb_percent_command(app, p), + "ui.colorWheel" => crate::panels::color_wheel::command(app, p), "ui.savePdfDialog" => crate::dialogs::open_save_pdf(app, p), "file.exportAs" if s("path").is_none() => { crate::dialogs::open_export_as(app, s("format").as_deref(), p); diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 97f477ebd1..947b15995d 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1398,6 +1398,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{} switch the Color panel's R, G and B between percent and 0 to 255, as a double-click right of an RGB field does (ui.colorPanel {rgbPercent}); the color does not change, and the choice is kept with the preferences; a parameter is an error and changes nothing → true when they show in percent", ), + ( + "ui.colorWheel", + "Color Wheel Options", + "", + "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue} show the Color Wheel panel's wheel or its box, as the panel menu's Wheel View and Box View do, and pick the box's channel, as Box Channel does: the box is a color field with the channel's strip at its right, and the field shows the other two components (hue: saturation across and brightness up; saturation: hue across and brightness up; brightness: hue across and saturation up; red: blue across and green up; green: blue across and red up; blue: red across and green up); keys left out keep their values, params that are not an object, another key or a value off the list are an error and change nothing, both are kept with the preferences, and the command does not open the panel (window.panel {panel: \"colorWheel\"} does) (ui.inspect: ui.color_wheel) → {view, channel}", + ), ( "ui.savePdfDialog", "Save PDF Dialog", diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 3420072605..f15a393d73 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -244,6 +244,7 @@ pub fn panel_menu_items(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) -> bool "attributes" => attributes::menu(app, ui), svg_interactivity::ID => svg_interactivity::menu(app, ui), "colorThemes" => color_themes::menu(app, ui), + color_wheel::ID => color_wheel::menu(app, ui), "layers" => layers::menu(app, ui), links::ID => links::menu(app, ui), asset_export::ID => asset_export::menu(app, ui), @@ -802,6 +803,8 @@ mod tests_brush_libraries; #[cfg(test)] mod tests_color_wheel; #[cfg(test)] +mod tests_color_wheel_box; +#[cfg(test)] mod tests_constrain; #[cfg(test)] mod tests_css_properties; diff --git a/crates/ui-egui/src/panels/color_wheel.rs b/crates/ui-egui/src/panels/color_wheel.rs index a2108d8cf8..31522578e5 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -6,8 +6,15 @@ //! space: an RGB, CMYK or Lab color keeps its model, and a Gray color or a tint of a global swatch //! becomes a process color in the document's color mode. The HSB picked last stays while the //! objects, the proxy, the color and the color settings are unchanged, so a gray keeps its hue. +//! +//! The panel menu's Box View puts a box in the wheel's place: a color field with a vertical +//! channel strip at its right, for the channel picked under Box Channel (Hue, Saturation, +//! Brightness, Red, Green or Blue). The field shows the other two components on the Color +//! Picker's axes. The view and the channel are kept with the preferences (`ui.colorWheel`). -use egui::{Ui, UiBuilder}; +use egui::{Ui, UiBuilder, vec2}; +use serde::{Deserialize, Serialize}; +use serde_json::{Value, json}; use vectorcraft_color::cms::{self, Cms}; use vectorcraft_color::{Color, Paint, hsb_to_rgb, rgb_to_hsb}; use vectorcraft_doc::{ColorMode, NodeId}; @@ -15,11 +22,189 @@ use vectorcraft_doc::{ColorMode, NodeId}; use super::color::{Target, apply, wheel_target}; use super::{pstate, set_pstate}; use crate::VectorcraftApp; -use crate::widgets::{self, FieldAxis, Live}; +use crate::dialogs::color_picker::Channel; +use crate::widgets::{self, FieldAxis, Live, SliderValue, menu_item}; pub const ID: &str = "colorWheel"; /// The widest the wheel is drawn. const MAX_WHEEL: f32 = 200.0; +/// The width of the box's channel strip, its arrows included. +const STRIP: f32 = 22.0; +/// The space between the box's field and its channel strip. +const STRIP_GAP: f32 = 6.0; + +/// What the panel shows right of the proxy: the wheel, or the box (a color field and a channel +/// strip). +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize)] +#[serde(rename_all = "camelCase")] +pub enum View { + #[default] + Wheel, + Box, +} + +impl View { + pub const ALL: [View; 2] = [View::Wheel, View::Box]; + + pub fn id(self) -> &'static str { + match self { + View::Wheel => "wheel", + View::Box => "box", + } + } + + pub fn parse(s: &str) -> Option { + Self::ALL.into_iter().find(|v| v.id() == s) + } +} + +/// The panel's settings, kept with the preferences (`UiState::color_wheel`, `ui.colorWheel`). +/// Each key reads on its own, and a value this build does not know reads as the key's default. +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase", default)] +pub struct Settings { + #[serde(deserialize_with = "deserialize_view")] + pub view: View, + #[serde(serialize_with = "serialize_channel", deserialize_with = "deserialize_channel")] + pub channel: Channel, +} + +fn deserialize_view<'de, D: serde::Deserializer<'de>>(d: D) -> Result { + let v = ::deserialize(d)?; + Ok(v.as_str().and_then(View::parse).unwrap_or_default()) +} + +fn serialize_channel(c: &Channel, s: S) -> Result { + s.serialize_str(c.id()) +} + +fn deserialize_channel<'de, D: serde::Deserializer<'de>>(d: D) -> Result { + let v = ::deserialize(d)?; + Ok(v.as_str().and_then(Channel::parse).unwrap_or_default()) +} + +/// Serde reader for the saved settings ([`crate::UiState::color_wheel`]): a value that is not an +/// object reads as the defaults, so it doesn't lose the rest of the preferences. +pub fn deserialize_settings<'de, D: serde::Deserializer<'de>>(d: D) -> Result { + let v = ::deserialize(d)?; + Ok(serde_json::from_value(v).unwrap_or_default()) +} + +/// `ui.colorWheel {view?, channel?}`: show the wheel or the box, and pick the box's channel. Keys +/// left out keep their values; params that are not an object, another key or a value off the list +/// are an error and change nothing. → the settings. +pub(crate) fn command(app: &mut VectorcraftApp, p: &Value) -> Result { + const KEYS: [&str; 2] = ["view", "channel"]; + match p { + Value::Null => {} + Value::Object(o) => { + if let Some(key) = o.keys().find(|k| !KEYS.contains(&k.as_str())) { + return Err(format!("unknown parameter `{key}`; the command takes: {}", KEYS.join(", "))); + } + } + got => return Err(format!("the params must be an object, not {got}")), + } + let mut set = app.ui.color_wheel.clone(); + match p.get("view") { + None | Some(Value::Null) => {} + Some(v) => set.view = v.as_str().and_then(View::parse).ok_or("`view` must be wheel or box")?, + } + match p.get("channel") { + None | Some(Value::Null) => {} + Some(v) => set.channel = v.as_str().and_then(Channel::parse).ok_or("`channel` must be hue, saturation, brightness, red, green or blue")?, + } + app.ui.color_wheel = set; + Ok(json!(app.ui.color_wheel)) +} + +/// The panel menu: Wheel View and Box View, and Box Channel while the box shows. +pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { + let set = app.ui.color_wheel.clone(); + for (label, view) in [(tl!("Wheel View"), View::Wheel), (tl!("Box View"), View::Box)] { + if menu_item(ui, label, true, set.view == view) { + command(app, &json!({ "view": view.id() })).ok(); + } + } + ui.add_enabled_ui(set.view == View::Box, |ui| { + ui.menu_button(format!(" {}", tl!("Box Channel")), |ui| { + for ch in Channel::ALL { + if menu_item(ui, ch.name(), true, ch == set.channel) { + command(app, &json!({ "channel": ch.id() })).ok(); + } + } + }); + }); +} + +/// The display values of HSB `hsb` in `ch`'s space, from 0 to 1: hue, saturation and brightness, +/// or red, green and blue. +fn box_values(ch: Channel, hsb: [f32; 3]) -> [f32; 3] { + if ch.is_hsb() { [hsb[0] / 360.0, hsb[1], hsb[2]] } else { hsb_to_rgb(hsb) } +} + +/// The strip's value and the field's point (x across, y down; 0 to 1 each) of HSB `hsb` in the box +/// of channel `ch`. +pub(crate) fn box_pos(ch: Channel, hsb: [f32; 3]) -> (f32, f32, f32) { + let v = box_values(ch, hsb); + let (z, x, y) = ch.axes(); + (v[z], v[x], 1.0 - v[y]) +} + +/// The HSB at strip value `z` and field point (x, y) in the box of channel `ch`: the inverse of +/// [`box_pos`]. A pick in an RGB channel that has no hue (a gray) keeps the hue of `was`. +pub(crate) fn box_pick(ch: Channel, z: f32, x: f32, y: f32, was: [f32; 3]) -> [f32; 3] { + let (zi, xi, yi) = ch.axes(); + let mut v = [0.0; 3]; + v[zi] = z; + v[xi] = x; + v[yi] = 1.0 - y; + let v = v.map(|c| c.clamp(0.0, 1.0)); + if ch.is_hsb() { + return [v[0] * 360.0, v[1], v[2]]; + } + let hsb = rgb_to_hsb(v); + if hsb[1] <= 0.0 || hsb[2] <= 0.0 { [was[0], hsb[1], hsb[2]] } else { hsb } +} + +/// The number the strip of channel `ch` reads to screen readers for HSB `hsb`, its suffix and its +/// largest value: hue in degrees, saturation and brightness in percent, red, green and blue from 0 +/// to 255. +fn strip_number(ch: Channel, hsb: [f32; 3]) -> (f64, &'static str, f64) { + let (units, suffix) = match ch { + Channel::Hue => (360.0, "°"), + Channel::Saturation | Channel::Brightness => (100.0, "%"), + Channel::Red | Channel::Green | Channel::Blue => (255.0, ""), + }; + let (z, _, _) = box_pos(ch, hsb); + (f64::from(z) * units, suffix, units) +} + +/// The box in a `size` × `size` area: the field of channel `ch` and its strip, on HSB `hsb`, with +/// markers when `marked`. Returns the HSB a click, a drag, a key or a screen reader's action picks, +/// and its phase. +fn show_box(ui: &mut Ui, ch: Channel, hsb: [f32; 3], marked: bool, size: f32) -> Option<([f32; 3], Live)> { + let (z, x, y) = box_pos(ch, hsb); + let mut pick = None; + ui.horizontal_top(|ui| { + ui.spacing_mut().item_spacing.x = STRIP_GAP; + let field = vec2((size - STRIP_GAP - STRIP).max(1.0), size); + let at = |x: f32, y: f32| widgets::hsb32(box_pick(ch, z, x, y, hsb)); + if let (Some((x, y)), phase) = widgets::color_field(ui, "color-wheel-box", (tl!("Color box"), ch.field_axes()), field, (x, y), marked, &at) { + pick = Some((box_pick(ch, z, x, y, hsb), phase)); + } + // The hue strip shows the whole spectrum; the others change only their own component. + let track = |z: f32| widgets::hsb32(if ch == Channel::Hue { [z * 360.0, 1.0, 1.0] } else { box_pick(ch, z, x, y, hsb) }); + let (v, suffix, max) = strip_number(ch, hsb); + let shown = SliderValue::field(v, 0.0..=max, suffix, 0); + match widgets::channel_slider_stepped(ui, "color-wheel-strip", ch.name(), Some(shown), z, marked, vec2(STRIP, size), &track) { + (Some(z), phase, _) => pick = Some((box_pick(ch, z, x, y, hsb), phase)), + (None, _, Some(v)) => pick = Some((box_pick(ch, (v / max) as f32, x, y, hsb), Live::Released)), + _ => {} + } + }); + pick +} + /// Panel state: the HSB picked last, its [`Owner`] and the display sRGB of the color it stored. const MEMORY: &str = "color-wheel-hsb"; @@ -132,6 +317,10 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { super::proxy(app, ui, 40.0); }); let size = ui.available_width().min(MAX_WHEEL); + if app.ui.color_wheel.view == View::Box { + pick = show_box(ui, app.ui.color_wheel.channel, hsb, marked, size); + return; + } let ring = widgets::hue_ring(ui, "color-wheel-ring", tl!("Hue ring"), size, hsb[0], marked); let square = widgets::ring_square(ring.rect); let mut field_ui = ui.new_child(UiBuilder::new().id_salt("color-wheel-square").max_rect(square)); diff --git a/crates/ui-egui/src/panels/tests_color_wheel_box.rs b/crates/ui-egui/src/panels/tests_color_wheel_box.rs new file mode 100644 index 0000000000..0b59a44d98 --- /dev/null +++ b/crates/ui-egui/src/panels/tests_color_wheel_box.rs @@ -0,0 +1,374 @@ +//! The Color Wheel panel's box view drawn headless: `ui.colorWheel`, the field and the strip of +//! each channel, the panel menu, the saved settings, the arrow keys and what screen readers read, +//! and the Color Picker's channel slider, which is the same widget as the strip. + +use egui::accesskit::{Action, ActionData, ActionRequest}; +use egui::{Event, Modifiers, PointerButton, Pos2, Rect, vec2}; +use egui_kittest::Harness; +use egui_kittest::kittest::{NodeT, Queryable}; +use serde_json::json; +use vectorcraft_color::Color; +use vectorcraft_color::cms; +use vectorcraft_engine::Session; + +use super::color_wheel::{Settings, View, box_pick, box_pos, display_hsb, show}; +use crate::VectorcraftApp; +use crate::dialogs::color_picker::Channel; + +/// An app with a selected rectangle filled with `fill`, its Color Wheel panel on the box of +/// `channel`. +fn app(fill: serde_json::Value, channel: &str) -> VectorcraftApp { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap(); + app.run("paint.setFill", json!({"color": fill})).unwrap(); + app.run("ui.colorWheel", json!({"view": "box", "channel": channel})).unwrap(); + app +} + +/// The panel in a 260-point-wide flyout, with the app's shortcuts after it as in a frame of the app. +fn harness(app: VectorcraftApp) -> Harness<'static, VectorcraftApp> { + let mut h = Harness::builder().with_size(vec2(260.0, 320.0)).build_ui_state( + |ui, app: &mut VectorcraftApp| { + show(app, ui); + crate::shortcuts::handle(app, ui.ctx()); + }, + app, + ); + h.run_steps(2); + h +} + +fn rect_of(h: &Harness<'static, VectorcraftApp>, label: &str) -> Rect { + h.get_by_label(label).rect() +} + +/// The point (x across, y up; 0..1 each) of `r`. +fn at(r: Rect, x: f32, y: f32) -> Pos2 { + Pos2::new(r.left() + x * r.width(), r.bottom() - y * r.height()) +} + +fn press(h: &mut Harness<'static, VectorcraftApp>, pos: Pos2, pressed: bool) { + h.event(Event::PointerMoved(pos)); + h.event(Event::PointerButton { pos, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE }); + h.run_steps(1); +} + +fn click(h: &mut Harness<'static, VectorcraftApp>, pos: Pos2) { + press(h, pos, true); + press(h, pos, false); + h.run_steps(1); +} + +/// A drag through `points`, pressed at the first and released at the last. +fn drag(h: &mut Harness<'static, VectorcraftApp>, points: &[Pos2]) { + let (Some(first), Some(last)) = (points.first(), points.last()) else { return }; + press(h, *first, true); + for p in points { + for _ in 0..2 { + h.event(Event::PointerMoved(*p)); + h.run_steps(1); + } + } + press(h, *last, false); + h.run_steps(1); +} + +fn key(h: &mut Harness<'static, VectorcraftApp>, key: egui::Key) { + h.key_press_modifiers(Modifiers::NONE, key); + h.run_steps(1); +} + +fn fill(app: &VectorcraftApp) -> Color { + crate::panels::current_paints(app).0.color().expect("a solid fill") +} + +fn hsb(c: &Color) -> [f32; 3] { + display_hsb(&cms::active(), c) +} + +fn rgb(c: &Color) -> [f32; 3] { + cms::active().display_rgb(c) +} + +fn near(a: [f32; 3], b: [f32; 3], tol: f32) -> bool { + (0..3).all(|i| (a[i] - b[i]).abs() <= tol) +} + +fn undo_len(app: &VectorcraftApp) -> usize { + app.session.doc().unwrap().history.undo.len() +} + +/// With Hue as the channel and a red fill, the field's top-left corner is white, its top-right +/// corner red and its bottom edge black. +#[test] +fn the_hue_box_picks_saturation_across_and_brightness_up() { + let mut h = harness(app(json!("#ff0000"), "hue")); + let field = rect_of(&h, "Color box"); + click(&mut h, field.left_top() + vec2(0.2, 0.2)); + assert!(near(rgb(&fill(h.state())), [1.0, 1.0, 1.0], 0.01), "{:?}", rgb(&fill(h.state()))); + click(&mut h, field.right_top() + vec2(-0.2, 0.2)); + assert!(near(rgb(&fill(h.state())), [1.0, 0.0, 0.0], 0.01), "the hue is kept through white: {:?}", rgb(&fill(h.state()))); + click(&mut h, at(field, 0.5, 0.0) + vec2(0.0, -0.2)); + assert!(near(rgb(&fill(h.state())), [0.0, 0.0, 0.0], 0.01), "{:?}", rgb(&fill(h.state()))); +} + +/// Red puts blue across and green up, as the Color Picker's field does, and red stays as it was. +#[test] +fn the_red_box_puts_blue_across_and_green_up() { + let mut h = harness(app(json!([0.2, 0.4, 0.6]), "red")); + let field = rect_of(&h, "Color box"); + let red = rgb(&fill(h.state()))[0]; + click(&mut h, at(field, 0.75, 0.25)); + assert!(near(rgb(&fill(h.state())), [red, 0.25, 0.75], 0.01), "{:?}", rgb(&fill(h.state()))); + let read = h.get_by_label("Color box").value().unwrap_or_default(); + assert!(read.starts_with("Blue ") && read.contains(", Green "), "{read}"); +} + +/// A drag in the field is one undo step, and a drag on the strip sets the third component. +#[test] +fn a_drag_in_the_field_is_one_undo_step_and_the_strip_sets_the_channel() { + let mut h = harness(app(json!([0.6, 0.3, 0.3]), "hue")); + let field = rect_of(&h, "Color box"); + let undo = undo_len(h.state()); + drag(&mut h, &[at(field, 0.2, 0.2), at(field, 0.5, 0.5), at(field, 0.8, 0.9)]); + assert_eq!(undo_len(h.state()), undo + 1, "one undo step"); + assert!(near(hsb(&fill(h.state())), [0.0, 0.8, 0.9], 0.01), "{:?}", hsb(&fill(h.state()))); + let strip = rect_of(&h, "Hue"); + drag(&mut h, &[strip.center_bottom() + vec2(0.0, -1.0), strip.center()]); + let after = hsb(&fill(h.state())); + assert!((after[0] - 180.0).abs() < 2.0 && (after[1] - 0.8).abs() < 0.01 && (after[2] - 0.9).abs() < 0.01, "{after:?}"); + assert_eq!(undo_len(h.state()), undo + 2); +} + +/// After a click on the strip, ↑ raises the channel by one unit, and the strip declares its range +/// and its adjust actions to screen readers. +#[test] +fn the_strip_takes_the_arrow_keys_and_screen_readers_actions() { + let mut h = harness(app(json!([0.6, 0.3, 0.3]), "brightness")); + let strip = rect_of(&h, "Brightness"); + click(&mut h, at(strip, 0.5, 0.5)); + let b = (hsb(&fill(h.state()))[2] * 100.0).round(); + key(&mut h, egui::Key::ArrowUp); + assert!((hsb(&fill(h.state()))[2] * 100.0 - (b + 1.0)).abs() < 0.01, "{:?}", hsb(&fill(h.state()))); + let node = h.get_by_label("Brightness").accesskit_node(); + assert!([Action::Increment, Action::Decrement, Action::SetValue].iter().all(|a| node.data().supports_action(*a))); + assert_eq!((node.data().min_numeric_value(), node.data().max_numeric_value()), (Some(0.0), Some(100.0))); + let (target_node, target_tree) = node.locate(); + let data = Some(ActionData::NumericValue(25.0)); + h.event(Event::AccessKitActionRequest(ActionRequest { target_node, target_tree, action: Action::SetValue, data })); + h.run_steps(1); + assert!((hsb(&fill(h.state()))[2] - 0.25).abs() < 0.01, "{:?}", hsb(&fill(h.state()))); +} + +/// `ui.colorWheel` sets the keys it is given and keeps the others, `{}` reads them, a value off the +/// list answers an error that names the accepted values and changes nothing, and `ui.inspect` +/// reports the settings. +#[test] +fn ui_color_wheel_sets_and_reads_the_view_and_the_channel() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + assert_eq!(app.run("ui.colorWheel", json!({})).unwrap(), json!({"view": "wheel", "channel": "hue"})); + assert_eq!(app.run("ui.colorWheel", json!({"view": "box"})).unwrap(), json!({"view": "box", "channel": "hue"})); + assert_eq!(app.run("ui.colorWheel", json!({"channel": "green"})).unwrap(), json!({"view": "box", "channel": "green"})); + let e = app.run("ui.colorWheel", json!({"view": "triangle"})).unwrap_err(); + assert_eq!(e, "`view` must be wheel or box"); + let e = app.run("ui.colorWheel", json!({"view": "wheel", "channel": 7})).unwrap_err(); + assert_eq!(e, "`channel` must be hue, saturation, brightness, red, green or blue"); + assert_eq!(app.ui.color_wheel, Settings { view: View::Box, channel: Channel::Green }, "an error changes nothing"); + let ui = crate::control::inspect(&app, &egui::Context::default()); + assert_eq!(ui["ui"]["color_wheel"], json!({"view": "box", "channel": "green"})); +} + +/// The command's errors are translated in the catalogs that translate status and error messages, +/// and each translation keeps the accepted values. +#[test] +fn ui_color_wheel_errors_are_translated() { + let errors = [ + ("`view` must be wheel or box", &["wheel", "box"][..]), + ("`channel` must be hue, saturation, brightness, red, green or blue", &["hue", "saturation", "brightness", "red", "green", "blue"][..]), + ]; + for code in [ + "cs", "de", "el", "es", "fr", "hi", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "zh-hans", "zh-hant", "fi", "tr", + "ca", "nl", "bs", "da", "id", + ] { + let lang = crate::i18n::Lang::from_code(code).expect("registered"); + for (error, values) in errors { + let shown = crate::i18n::message(lang, error); + assert_ne!(shown, error, "{code}"); + assert!(values.iter().all(|v| shown.contains(v)), "{code}: {shown}"); + } + } +} + +/// Params that are not an object, and a key the command does not take, are errors that change +/// nothing. +#[test] +fn ui_color_wheel_rejects_other_params() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("ui.colorWheel", json!({"view": "box", "channel": "red"})).unwrap(); + let e = app.run("ui.colorWheel", json!("box")).unwrap_err(); + assert_eq!(e, "the params must be an object, not \"box\""); + let e = app.run("ui.colorWheel", json!([1])).unwrap_err(); + assert_eq!(e, "the params must be an object, not [1]"); + let e = app.run("ui.colorWheel", json!({"veiw": "wheel"})).unwrap_err(); + assert_eq!(e, "unknown parameter `veiw`; the command takes: view, channel"); + let e = app.run("ui.colorWheel", json!({"view": "wheel", "chanel": "blue"})).unwrap_err(); + assert_eq!(e, "unknown parameter `chanel`; the command takes: view, channel"); + assert_eq!(app.ui.color_wheel, Settings { view: View::Box, channel: Channel::Red }, "an error changes nothing"); +} + +/// With None there is no color to edit: the strip reads 0 to screen readers, as the hue ring does, +/// and its actions still set the fill from the last solid color the box shows. +#[test] +fn with_a_none_fill_the_strip_reads_zero_and_its_actions_set_the_fill() { + let mut app = app(json!("#ff0000"), "brightness"); + app.run("paint.setFill", json!({"none": true})).unwrap(); + let mut h = harness(app); + assert_eq!(h.get_by_label("Color box").value(), None, "no marker in the field"); + let node = h.get_by_label("Brightness").accesskit_node(); + assert_eq!(node.data().numeric_value(), Some(0.0), "no value on the strip"); + let last = hsb(&h.state().session.last_solid); + let (target_node, target_tree) = node.locate(); + let data = Some(ActionData::NumericValue(25.0)); + h.event(Event::AccessKitActionRequest(ActionRequest { target_node, target_tree, action: Action::SetValue, data })); + h.run_steps(1); + assert!(near(hsb(&fill(h.state())), [last[0], last[1], 0.25], 0.01), "{last:?} → {:?}", hsb(&fill(h.state()))); +} + +/// With None, a screen reader's set-value action or an increment at the top of the strip sets the +/// fill, even when the number equals the last solid color's. +#[test] +fn with_a_none_fill_the_strip_applies_an_action_that_leaves_its_number() { + let mut app = app(json!("#ff0000"), "brightness"); + app.run("paint.setFill", json!({"none": true})).unwrap(); + let mut h = harness(app); + let last = hsb(&h.state().session.last_solid); + assert!((last[2] - 1.0).abs() < 0.01, "{last:?}"); + for (action, data) in [(Action::SetValue, Some(ActionData::NumericValue(100.0))), (Action::Increment, None)] { + h.state_mut().run("paint.setFill", json!({"none": true})).unwrap(); + h.run_steps(1); + let (target_node, target_tree) = h.get_by_label("Brightness").accesskit_node().locate(); + h.event(Event::AccessKitActionRequest(ActionRequest { target_node, target_tree, action, data })); + h.run_steps(1); + let paint = crate::panels::current_paints(h.state()).0; + let c = paint.color().unwrap_or_else(|| panic!("{action:?} left the fill as {paint:?}")); + assert!(near(hsb(&c), last, 0.01), "{action:?}: {last:?} → {:?}", hsb(&c)); + } +} + +/// `ui.colorWheel` answers every junk parameter without a panic. +#[test] +fn ui_color_wheel_answers_junk_params_without_a_panic() { + let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == "ui.colorWheel").expect("registered").3; + let mut app = app(json!("#336699"), "hue"); + for p in vectorcraft_testkit::strategies::junk_params(doc, "/nonexistent").into_iter().chain(vectorcraft_testkit::strategies::junk_values()) { + let _ = app.run("ui.colorWheel", p); + } +} + +/// The settings survive a JSON round trip of the preferences, and a saved value this build does +/// not know reads as the key's default without losing the other preferences. +#[test] +fn the_settings_are_kept_and_read_leniently() { + let ui = crate::UiState { color_wheel: Settings { view: View::Box, channel: Channel::Blue }, color_rgb_percent: true, ..Default::default() }; + let saved = serde_json::to_value(&ui).unwrap(); + let back: crate::UiState = serde_json::from_value(saved.clone()).unwrap(); + assert_eq!(back.color_wheel, ui.color_wheel); + let mut odd = saved.clone(); + odd["color_wheel"] = json!({"view": "triangle", "channel": 7, "later": true}); + let back: crate::UiState = serde_json::from_value(odd).unwrap(); + assert_eq!(back.color_wheel, Settings::default()); + assert!(back.color_rgb_percent, "the other preferences are kept"); + // Each key reads on its own: an unknown channel does not reset a known view, or the reverse. + let mut odd = saved.clone(); + odd["color_wheel"] = json!({"view": "box", "channel": 7}); + let back: crate::UiState = serde_json::from_value(odd).unwrap(); + assert_eq!(back.color_wheel, Settings { view: View::Box, channel: Channel::default() }); + let mut odd = saved.clone(); + odd["color_wheel"] = json!({"view": "triangle", "channel": "blue"}); + let back: crate::UiState = serde_json::from_value(odd).unwrap(); + assert_eq!(back.color_wheel, Settings { view: View::Wheel, channel: Channel::Blue }); + let mut odd = saved; + odd["color_wheel"] = json!("box"); + let back: crate::UiState = serde_json::from_value(odd).unwrap(); + assert_eq!(back.color_wheel, Settings::default()); + assert!(back.color_rgb_percent); +} + +/// The panel menu lists Wheel View and Box View with the shown one checked, and Box Channel; its +/// items set the view and the channel. +#[test] +fn the_panel_menu_switches_the_view_and_the_channel() { + let mut app = app(json!("#ff0000"), "hue"); + app.run("ui.colorWheel", json!({"view": "wheel"})).unwrap(); + let mut fonts = false; + let mut h = Harness::builder().with_size(vec2(260.0, 320.0)).build_ui_state( + move |ui, app: &mut VectorcraftApp| { + // The fonts, which draw the check mark, take effect from the next frame. + if !fonts { + crate::theme::install_fonts(ui.ctx()); + fonts = true; + return; + } + assert!(super::panel_menu_items(app, ui, super::color_wheel::ID)); + }, + app, + ); + h.run_steps(3); + assert!(h.query_by_label("✓ Wheel View").is_some()); + h.get_by_label(" Box View").click(); + h.run_steps(2); + assert_eq!(h.state().ui.color_wheel.view, View::Box); + assert!(h.query_by_label("✓ Box View").is_some()); +} + +/// Every channel's box puts each color back where it reads it, and the strip's value is the +/// channel's own component. +#[test] +fn box_pick_inverts_box_pos_for_every_channel() { + for ch in Channel::ALL { + for hsb in [[30.0, 0.6, 0.8], [200.0, 0.25, 0.5], [300.0, 1.0, 1.0]] { + let (z, x, y) = box_pos(ch, hsb); + let back = box_pick(ch, z, x, y, [0.0, 0.0, 0.0]); + assert!(near(back, hsb, 1e-3), "{ch:?}: {hsb:?} → {back:?}"); + } + } + // A gray picked in an RGB channel keeps the hue it had. + assert_eq!(box_pick(Channel::Red, 0.5, 0.5, 0.5, [120.0, 0.3, 0.3])[0], 120.0); +} + +/// The Color Picker's channel slider is the same widget as the strip: after a click on it, ↑ raises +/// its channel by one unit. +#[test] +fn the_color_pickers_channel_slider_takes_the_arrow_keys() { + let mut app = app(json!([0.6, 0.3, 0.3]), "hue"); + app.run("ui.colorPicker", json!({})).unwrap(); + let mut fonts = false; + let mut h = Harness::builder().with_size(vec2(1000.0, 800.0)).build_ui_state( + move |ui, app: &mut VectorcraftApp| { + // The fonts take effect from the next frame. + if !fonts { + crate::theme::install_fonts(ui.ctx()); + fonts = true; + return; + } + crate::dialogs::show(app, ui.ctx()); + }, + app, + ); + h.run_steps(3); + // The H field beside the values has the same name; the slider is the tall one. + let rail = h.get_all_by_label("H").map(|n| n.rect()).find(|r| r.height() > 100.0).expect("the channel slider"); + click(&mut h, rail.center()); + let picked = |h: &Harness<'static, VectorcraftApp>| -> [f32; 3] { + serde_json::from_value(h.state().ui.dialog.as_ref().unwrap().fields["__hsb"].clone()).unwrap() + }; + let before = picked(&h); + key(&mut h, egui::Key::ArrowUp); + let after = picked(&h); + assert!((after[0] - (before[0].round() + 1.0)).abs() < 1e-3, "{before:?} → {after:?}"); + assert!(near([0.0, after[1], after[2]], [0.0, before[1], before[2]], 1e-4), "{before:?} → {after:?}"); + let slider = h.get_all_by_label("H").find(|n| n.rect().height() > 100.0).expect("the channel slider"); + let node = slider.accesskit_node(); + assert!([Action::Increment, Action::Decrement, Action::SetValue].iter().all(|a| node.data().supports_action(*a))); +} diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 5f686af203..ed9e34b057 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -754,6 +754,10 @@ pub struct UiState { /// of an RGB field, `ui.colorPanel`, [`crate::panels::color::deserialize_rgb_percent`]). #[serde(default, deserialize_with = "crate::panels::color::deserialize_rgb_percent")] pub color_rgb_percent: bool, + /// Color Wheel panel: the wheel or the box, and the box's channel (`ui.colorWheel`, + /// [`crate::panels::color_wheel::deserialize_settings`]). + #[serde(default, deserialize_with = "crate::panels::color_wheel::deserialize_settings")] + pub color_wheel: crate::panels::color_wheel::Settings, /// Swatches panel: Show Recent Colors in its panel menu, which draws the panel's Recent Colors /// row (#6617; read as [`Self::color_show_recent_colors`] is). Separate from the Color panel's. #[serde(default = "yes", deserialize_with = "crate::panels::color::deserialize_show_recent_colors")] @@ -1258,6 +1262,7 @@ impl Default for UiState { color_hide_options: false, color_show_recent_colors: true, color_rgb_percent: false, + color_wheel: Default::default(), swatches_show_recent_colors: true, svg_options: Value::Null, place_link: true, diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 797602dcc5..d3278f667d 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -37,9 +37,10 @@ pub(crate) use buttons::{ use chips::gradient_chip_colors; pub use chips::{ProxyClicks, chip_button, chip_button_named, fill_stroke_proxy, gradient_chip, paint_chip, proxy_chip, swatch_tile}; pub use color::{ - FieldAxis, Live, RingResponse, SliderValue, WheelAxes, WheelResponse, channel_slider, channel_slider_named, channel_slider_valued, color_field, - color_mesh, color_slider, color_slider_named, color_slider_stepped, color_slider_valued, harmony_wheel, hex_field, hex_field_named, hsb32, - hue_ring, region_texture, ring_square, segment_color, segment_color_on, segmented_wheel, stepped_area, wheel_of, + FieldAxis, Live, RingResponse, SliderValue, WheelAxes, WheelResponse, channel_slider, channel_slider_named, channel_slider_stepped, + channel_slider_valued, color_field, color_mesh, color_slider, color_slider_named, color_slider_stepped, color_slider_valued, harmony_wheel, + hex_field, hex_field_named, hsb32, hue_ring, region_texture, ring_square, segment_color, segment_color_on, segmented_wheel, stepped_area, + wheel_of, }; pub(crate) use color::{HEX_FIELD_CHARS, hex_text, pointer_phase}; pub use drag::{ diff --git a/crates/ui-egui/src/widgets/color.rs b/crates/ui-egui/src/widgets/color.rs index 6b09d3da30..49c3ba73a1 100644 --- a/crates/ui-egui/src/widgets/color.rs +++ b/crates/ui-egui/src/widgets/color.rs @@ -141,7 +141,7 @@ pub fn color_slider_stepped( ) -> (Option, Live, Option) { let id = id_with(ui.scope_id(), id); let (resp, picked, phase) = color_rail(ui, id, name, shown.clone(), value, width, track); - let stepped = slider_keys(ui, &resp, shown); + let stepped = slider_keys(ui, &resp, shown, false); (picked, phase, stepped.filter(|_| picked.is_none())) } @@ -152,12 +152,13 @@ pub fn color_slider_stepped( /// `shown`'s units that a key or an action gives. pub fn stepped_area(ui: &Ui, resp: &Response, name: &str, shown: Option) -> Option { slider_info(ui, resp, name, shown.clone()); - slider_keys(ui, resp, shown) + slider_keys(ui, resp, shown, false) } /// The focus, keys, actions and focus outline of [`color_slider_stepped`] on the control `resp`: -/// the number a key or an action gives. -fn slider_keys(ui: &Ui, resp: &Response, shown: Option) -> Option { +/// the number a key or an action gives. With `always`, a key or an action that leaves the number +/// as it was still gives it. +fn slider_keys(ui: &Ui, resp: &Response, shown: Option, always: bool) -> Option { let id = resp.id; // Focus a click or a drag gave shows no outline until a key steps the rail: the outline tells // a keyboard user where the focus is, and after a drag it only framed the rail. @@ -177,7 +178,7 @@ fn slider_keys(ui: &Ui, resp: &Response, shown: Option) -> Option(by_pointer)); @@ -190,8 +191,9 @@ fn slider_keys(ui: &Ui, resp: &Response, shown: Option) -> Option Option { +/// readers' actions on it ([`color_slider_stepped`]); `None` when they leave it as it was, unless +/// `always` and a key or an action came. +fn rail_step(ui: &Ui, id: egui::Id, focused: bool, always: bool, s: &SliderValue) -> Option { use egui::accesskit::{Action, ActionData}; use egui::{Event, Key}; let (lo, hi) = (*s.range.start(), *s.range.end()); @@ -208,6 +210,8 @@ fn rail_step(ui: &Ui, id: egui::Id, focused: bool, s: &SliderValue) -> Option Option return true, } + asked = true; false }); }); @@ -246,8 +251,9 @@ fn rail_step(ui: &Ui, id: egui::Id, focused: bool, s: &SliderValue) -> Option 0; + v = by(v, up as f64 - down as f64).clamp(lo, hi); // The last set-value request this frame. let set = i.accesskit_action_requests(id, Action::SetValue).last().and_then(|request| match request.data { Some(ActionData::NumericValue(value)) if value.is_finite() => Some(value), @@ -260,9 +266,10 @@ fn rail_step(ui: &Ui, id: egui::Id, focused: bool, s: &SliderValue) -> Option Color32, ) -> (Option, Live) { + let id = id_with(ui.scope_id(), id); + let (_, picked, phase) = channel_rail(ui, id, name, shown, value, true, size, track); + (picked, phase) +} + +/// [`channel_slider_valued`] that also responds to the keyboard and to screen readers' actions as +/// the rail of [`color_slider_stepped`] does: a click or a drag gives it the keyboard focus, and +/// while it has the focus ↑ and → raise the number `shown` holds and ↓ and ← lower it. When not +/// `marked`, the rail draws no arrows and screen readers read 0, as [`hue_ring`] does, while the +/// keys and actions still step from `shown` and give a number even when it equals `shown`'s, as +/// [`color_field`] does. Returns the new value from 0 to 1 that a click or a +/// drag gives, its phase, and the number in `shown`'s units that a key or an action gives. +#[allow(clippy::too_many_arguments)] +pub fn channel_slider_stepped( + ui: &mut Ui, + id: impl std::hash::Hash, + name: &str, + shown: Option, + value: f32, + marked: bool, + size: Vec2, + track: &dyn Fn(f32) -> Color32, +) -> (Option, Live, Option) { + let id = id_with(ui.scope_id(), id); + let read = if marked { shown.clone() } else { shown.as_ref().map(|s| SliderValue { value: 0.0, text: None, ..s.clone() }) }; + let (resp, picked, phase) = channel_rail(ui, id, name, read, value, marked, size, track); + let stepped = slider_keys(ui, &resp, shown, !marked); + (picked, phase, stepped.filter(|_| picked.is_none())) +} + +/// The vertical rail of [`channel_slider_valued`] with the id `id`, with its arrows at `value` +/// when `marked`: its response, the new value from 0 to 1 that a click or drag gives and the +/// phase. +#[allow(clippy::too_many_arguments)] +fn channel_rail( + ui: &mut Ui, + id: egui::Id, + name: &str, + shown: Option, + value: f32, + marked: bool, + size: Vec2, + track: &dyn Fn(f32) -> Color32, +) -> (Response, Option, Live) { let t = Tokens::get(ui.ctx()); let (rect, _) = ui.allocate_exact_size(size, Sense::hover()); - let resp = ui.interact(rect, id_with(ui.scope_id(), id), Sense::click_and_drag()); + let resp = ui.interact(rect, id, Sense::click_and_drag()); let bar = rect.shrink2(vec2(6.0, 0.0)); gradient_strip(ui, bar, (bar.height() / 2.0).ceil().max(2.0) as usize, true, track); ui.painter().rect_stroke(bar, 0.0, Stroke::new(1.0, t.border), StrokeKind::Outside); let y = bar.bottom() - value.clamp(0.0, 1.0) * bar.height(); let fill = if resp.dragged() || resp.hovered() { t.text_strong } else { t.icon }; - for (x, d) in [(rect.left(), 1.0), (rect.right(), -1.0)] { + for (x, d) in [(rect.left(), 1.0), (rect.right(), -1.0)].into_iter().filter(|_| marked) { let tip = pos2(x + d * 5.0, y); ui.painter().add(egui::Shape::convex_polygon(vec![tip, pos2(x, y + 4.0 * d), pos2(x, y - 4.0 * d)], fill, Stroke::NONE)); } slider_info(ui, &resp, name, shown); - match pointer_phase(&resp) { + let (picked, phase) = match pointer_phase(&resp) { Some((p, phase)) => (Some(((bar.bottom() - p.y) / bar.height()).clamp(0.0, 1.0)), phase), None => (None, Live::Idle), - } + }; + (resp, picked, phase) } /// A hex colour field (`E67828`, no `#`) after a `#` label. Returns the text on commit when it diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 23894fd6f6..9a0ec9d917 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -265,7 +265,9 @@ My Themes tab lists the saved themes; every action runs a command (`colorTheme.s Color Wheel panel (`window.panel {panel: "colorWheel"}`): a hue ring around a saturation and brightness square. A pick runs the commands the Color panel's sliders run: `paint.setFill` or `paint.setStroke` with `keepModel`, `paint.editGradient` for a gradient's selected stop, and `paint.freeform.setPoint` for a freeform gradient's selected -point (the first stop or point when none is selected). +point (the first stop or point when none is selected). `ui.colorWheel {view?, channel?}` shows the wheel or the box (a +color field with a channel strip at its right) and picks the box's channel; it returns the settings, and `ui.inspect` +reports them as `ui.color_wheel`. Edit Colors dialogs: `ui.colorBalanceDialog` opens Adjust Colors (`colorBalance`: fields `mode` `gray`/`rgb`/`cmyk`/ `global`, the channels `r` `g` `b` / `c` `m` `y` `k` / `gray` / `tint` (global mode) from −100 to 100, `convert`, `fill`, `stroke`, diff --git a/docs/mcp.md b/docs/mcp.md index a98e9a588f..1d3a6145b4 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -670,6 +670,11 @@ applied colors still join the list while it is hidden. `ui.colorPanel {"rgbPerce RGB fields in percent, as a double-click right of an RGB field does, and `false` shows them from 0 to 255 again. `ui.colorRgbPercent` (Toggle RGB Percent in the command palette and Keyboard Shortcuts) switches between the two and answers true when the fields show in percent. +`ui.colorWheel {"view": "box", "channel": "red"}` shows the Color Wheel panel's box (a color field with the channel's +strip at its right) in place of the wheel, as the panel menu's Box View and Box Channel do, and `"view": "wheel"` +shows the wheel again. Keys left out keep their values. Params that are not an object, another key or a value off +the list return an error and change nothing. The command returns `{view, channel}`, and both settings are kept with +the preferences. In remote desktop mode, `invoke_menu` with `{"command":"ui.sampleScreenColor","params":{}}` shows the system's screen color sampler and returns `null` before a color is picked: the system's sampler on macOS, the XDG desktop diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 927874d942..18d8711f10 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1755,7 +1755,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Colorized images (#1466):** a fill color applied to a selected grayscale or 1-bit image (`paint.setFill`) colorizes it with black, white, a process color or a spot color, and refuses a process color when the image has an alpha channel ([Convert color modes](https://web.archive.org/web/20251220223850/https://helpx.adobe.com/illustrator/desktop/manage-colors/select-and-adjust-colors/convert-color-modes.html), "Colorize Grayscale or 1-bit images"); black and white are accepted there too. The canvas draws each pixel in the color as far as the pixel is dark, with white pixels transparent; PDF export writes the image in the color (a spot color as its ink, Registration in every ink) with the image as its soft mask; Separations Preview and printed separations show it on its color's plates; native files keep the color. EPS and SVG write the image's own pixels. - **Missing library files:** a persistent swatch or graphic style library panel whose file is gone at startup reopens and stays in the preferences, showing the file's path with Locate Library… (`ui.libraryPanel.locate`), which reads the file from where it is now into the same panel. - **Swatch library and Recolor Artwork parameters:** the `swatch.library.*` commands, `swatch.resetDefaults`, the graphic style library save, load and add, the `recolor.*` commands and `color.harmony`'s `limitTo` refuse parameters of the wrong form, such as `names: "Grays"`, `limitTo: 5` or `includeImages: "false"`. Errors name the parameter, except that a `limitTo` that is not a string, such as `5`, gets an unknown-library error. A `null` counts as left out except for `recolor.apply`'s `model`, which must be a string when given. - - **Color Wheel panel (part of #978):** Window › Color Wheel shows the Fill and Stroke proxy beside a hue ring around a square with saturation across and brightness up. It edits what the Color panel's sliders edit (the active proxy's color, the selected gradient stop or freeform point) through the same paint commands, and a drag is one undo step. Alt paints the other proxy, and Shift steps the ring by 45°. A pick goes from display sRGB into the working RGB space; an RGB, CMYK or Lab color keeps its model, and a Gray color or a tint of a global swatch becomes a process color in the document's color mode. A click gives the ring or the square the keyboard focus, and the arrow keys then step the color; both report their names and values to screen readers, and the Color Picker's color field takes the same keys. Scores and estimates are unchanged. + - **Color Wheel panel (part of #978):** Window › Color Wheel shows the Fill and Stroke proxy beside a hue ring around a square with saturation across and brightness up. It edits what the Color panel's sliders edit (the active proxy's color, the selected gradient stop or freeform point) through the same paint commands, and a drag is one undo step. Alt paints the other proxy, and Shift steps the ring by 45°. A pick goes from display sRGB into the working RGB space; an RGB, CMYK or Lab color keeps its model, and a Gray color or a tint of a global swatch becomes a process color in the document's color mode. A click gives the ring or the square the keyboard focus, and the arrow keys then step the color; both report their names and values to screen readers, and the Color Picker's color field takes the same keys. The panel menu's Box View puts a box in the wheel's place: a color field with a channel strip at its right for Hue, Saturation, Brightness, Red, Green or Blue (Box Channel), on the Color Picker's axes, kept with the preferences (`ui.colorWheel`); the strip and the Color Picker's channel slider take the arrow keys after a click. Scores and estimates are unchanged. - **Colour:** a Color Picker (colour field, H/S/B/R/G/B channel slider, HSB/RGB/Lab/CMYK fields, hex, web-only snapping, out-of-gamut correction); the Color panel shows a selected colour in its own model and, with nothing selected, the new-art defaults in the mode picked last, which it keeps between sessions; Alt-click paints the other proxy; proxies look through groups and show "?" for mixed paint; Invert, Complement, Apply Last Color (`,`) and Apply Last Gradient (`.`) keep the colour model; every paint command feeds the recent colours. The Color Guide has 21 harmony rules, Steps and Variation options and Limit to Library. Adjust Color Balance (its Global mode shifts tints) and Saturate preview live; Edit Colors and Recolor also reach meshes, images and patterns. Recolor Artwork has colour reduction, five recolour methods, presets, Limit to Library, a colour-wheel Edit tab and Edit Color Group; a local Color Themes panel saves five-colour themes. Fill/Stroke chips open swatch and mixer popovers (the Properties panel has the Control bar's Fill and Stroke chips, Stroke link and weight spinner, with nothing selected too), panels have Illustrator's Window menu keys (Align Shift+F7, Transform Shift+F8, Pathfinder Cmd+Shift+F9, Layers F7, Character Cmd+T…; every panel can be given one in Edit › Keyboard Shortcuts), and Eyedropper Options pick up and apply chosen attributes (Alt and Shift+Alt, image pixels). An ICC CMYK profile converts straight into the RGB working space (not through sRGB, so a wider space such as Wide Gamut RGB keeps colours sRGB can't hold) with the colour settings' black-point compensation, on the canvas and in RGB exports alike (the built-in Generic CMYK compensates both ways, so RGB black separated to a rich black displays as black again). Fills and strokes can overprint (Attributes panel, Overprint Black options), and CMYK documents blend in inks on screen, in PDF and when flattening. Document Color Mode converts the art, symbols, pattern tiles and swatches through the colour settings: Gray stays Gray, RGB grays separate into light grays in cyan, magenta and yellow only, darker four-color grays and a rich black, or go on the black plate only with `grays: "black"` (also for `document.open {colorMode}`). Plain Comma and Period, and also Shift+Comma and Shift+Period, apply the last solid color and the last gradient to the active Fill or Stroke proxy in VectorCraft ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), "Select color fill mode" and "Select gradient fill mode"). Recent Colors keeps the last 30 solid colors applied, newest first and each once, and the list stays the same when another document is opened or made active; a 31st color drops the oldest ([Select colors using the Color panel](https://helpx.adobe.com/illustrator/desktop/manage-colors/select-and-adjust-colors/select-colors-using-the-color-panel.html)). The list lasts for the session. In the Color and Swatches panels the chips wrap onto further rows when the panel is too narrow for one row (`paint.recent`). Tests: `recent_colors_keep_thirty_colors_across_documents` in `crates/engine/src/tests/paintproxy.rs`, `all_thirty_recent_colors_wrap_into_a_narrow_panel` in `crates/ui-egui/src/panels/color/tests.rs`.