From 605a9df93a49ab51853590c9034588cce92f29b8 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 07:24:42 -0800 Subject: [PATCH 1/2] Color Wheel: the wheel shows the colors of a harmony rule The Color Wheel panel menu has Show Harmony and Harmony Rule. With Show Harmony on, the wheel's ring carries a marker for each other color of the picked rule, filled with that color, and the markers follow the current color. A click on a marker, or Enter or Space on a focused one, applies its color as a pick on the wheel does; Alt applies it to the inactive Fill/Stroke proxy. Screen readers read each marker as "Harmony color" with its hex value. The wheel takes the 15 Color Guide rules whose colors each have a hue of their own. Harmony::apply_hsb gives a rule's colors as HSB, and a gray base keeps its hue so the markers stay apart on the ring. ui.colorWheel takes harmony and harmonyRule, and both are kept with the preferences. Docs: docs/mcp.md, docs/target-app-parity.md. --- crates/color/src/harmony.rs | 53 ++- crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/i18n/bg.tsv | 3 + crates/ui-egui/src/i18n/bs.tsv | 3 + crates/ui-egui/src/i18n/ca.tsv | 3 + crates/ui-egui/src/i18n/cs.tsv | 3 + crates/ui-egui/src/i18n/da.tsv | 3 + crates/ui-egui/src/i18n/de.tsv | 3 + crates/ui-egui/src/i18n/el.tsv | 3 + crates/ui-egui/src/i18n/es.tsv | 3 + crates/ui-egui/src/i18n/fi.tsv | 3 + crates/ui-egui/src/i18n/fr.tsv | 3 + crates/ui-egui/src/i18n/gu.tsv | 3 + crates/ui-egui/src/i18n/hi.tsv | 3 + crates/ui-egui/src/i18n/hu.tsv | 3 + crates/ui-egui/src/i18n/id.tsv | 3 + crates/ui-egui/src/i18n/it.tsv | 3 + crates/ui-egui/src/i18n/ja.tsv | 3 + crates/ui-egui/src/i18n/ka.tsv | 3 + crates/ui-egui/src/i18n/ko.tsv | 3 + crates/ui-egui/src/i18n/nl.tsv | 3 + crates/ui-egui/src/i18n/pl.tsv | 3 + crates/ui-egui/src/i18n/pt-br.tsv | 3 + crates/ui-egui/src/i18n/ru.tsv | 3 + crates/ui-egui/src/i18n/sv.tsv | 3 + crates/ui-egui/src/i18n/tr.tsv | 3 + crates/ui-egui/src/i18n/uk.tsv | 3 + crates/ui-egui/src/i18n/vi.tsv | 3 + crates/ui-egui/src/i18n/zh-hans.tsv | 3 + crates/ui-egui/src/i18n/zh-hant.tsv | 3 + crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/panels.rs | 2 + crates/ui-egui/src/panels/color_wheel.rs | 93 ++++- .../src/panels/tests_color_wheel_box.rs | 32 +- .../src/panels/tests_color_wheel_harmony.rs | 330 ++++++++++++++++++ crates/ui-egui/src/widgets.rs | 2 +- crates/ui-egui/src/widgets/color.rs | 34 ++ docs/mcp.md | 9 +- docs/target-app-parity.md | 2 +- 39 files changed, 616 insertions(+), 29 deletions(-) create mode 100644 crates/ui-egui/src/panels/tests_color_wheel_harmony.rs diff --git a/crates/color/src/harmony.rs b/crates/color/src/harmony.rs index 8bdff7103d..b1476932f6 100644 --- a/crates/color/src/harmony.rs +++ b/crates/color/src/harmony.rs @@ -176,18 +176,33 @@ impl Harmony { /// The rule's colours in the base colour's model, the base colour itself first. pub fn apply(self, base: Color) -> Vec { - let [h, s, v] = base.to_hsb(); - std::iter::once(base) - .chain(self.tones()[1..].iter().map(|tone| { + let rest = self.apply_hsb(base.to_hsb()).into_iter().skip(1); + std::iter::once(base).chain(rest.map(|[h, s, v]| keep_model(base, Color::from_hsb(h, s, v)))).collect() + } + + /// The rule's colours as HSB from base HSB `hsb`, the base first: hue in degrees from 0 to 360, + /// saturation and brightness from 0 to 1. A gray base keeps its hue, so the colours keep their + /// places around a hue wheel. + pub fn apply_hsb(self, [h, s, v]: [f32; 3]) -> Vec<[f32; 3]> { + self.tones() + .iter() + .map(|tone| { let b = match tone.bright { Bright::Times(f) => v * f, Bright::Contrast => contrast(v), }; - keep_model(base, Color::from_hsb(h + tone.turn, (s * tone.sat).clamp(0.0, 1.0), b.clamp(0.0, 1.0))) - })) + [(h + tone.turn).rem_euclid(360.0), (s * tone.sat).clamp(0.0, 1.0), b.clamp(0.0, 1.0)] + }) .collect() } + /// Whether every colour of the rule has a hue of its own (Triad, but not Triad 2 or + /// Monochromatic), so that each can sit on a hue ring apart from the others. + pub fn hues_differ(self) -> bool { + let turns: Vec = self.tones().iter().map(|t| t.turn.rem_euclid(360.0)).collect(); + turns.iter().enumerate().all(|(i, a)| turns[..i].iter().all(|b| a != b)) + } + /// A [`THEME_SIZE`]-colour theme from `base`: the rule's colours, each followed by the lighter or /// darker variations of it that fill the remaining places (the rule's first colours get them /// first). The base colour comes first, every colour in its model. @@ -403,6 +418,34 @@ mod tests { assert_eq!(Harmony::parse("square"), None); } + /// A rule's HSB colours match the colours `apply` gives, and a gray base keeps its hue, so its + /// colours turn around the hue ring from it. + #[test] + fn hsb_colours_match_and_keep_a_grays_hue() { + for h in Harmony::ALL { + let base = Color::rgb8(230, 120, 40); + let hsb = h.apply_hsb(base.to_hsb()); + let colors = h.apply(base); + assert_eq!(hsb.len(), colors.len(), "{}", h.label()); + for (a, c) in hsb.iter().zip(&colors).skip(1) { + assert_eq!(Color::from_hsb(a[0], a[1], a[2]).to_hex(), c.to_hex(), "{}", h.label()); + } + } + let gray = Harmony::Triad.apply_hsb([40.0, 0.0, 0.5]); + assert_eq!(gray.iter().map(|c| c[0]).collect::>(), [40.0, 160.0, 280.0]); + assert_eq!(Harmony::Analogous.apply_hsb([10.0, 1.0, 1.0])[2][0], 340.0, "hues wrap to 0..360"); + } + + /// Fifteen rules give every colour its own hue; the six that repeat a hue are left out. + #[test] + fn rules_whose_colours_all_have_their_own_hue() { + let differ: Vec = Harmony::ALL.into_iter().filter(|h| h.hues_differ()).collect(); + assert_eq!(differ.len(), 15); + for h in [Harmony::Complementary2, Harmony::Monochromatic, Harmony::Shades, Harmony::Triad2, Harmony::Triad3, Harmony::HighContrast2] { + assert!(!h.hues_differ(), "{}", h.label()); + } + } + #[test] fn high_contrast_flips_brightness() { let light = Harmony::HighContrast.apply(Color::rgb(0.9, 0.8, 0.2)); diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 943faa4782..1bfede850d 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1324,7 +1324,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "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}", + "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, harmony?: bool, harmonyRule?: complementary|splitComplementary|leftComplement|rightComplement|analogous|analogous2|triad|tetrad|tetrad2|tetrad3|compound|compound2|highContrast|highContrast3|pentagram} 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); harmony shows a marker on the wheel's ring for each other color of harmonyRule (the Color Guide's rule of that id; a rule's label is taken too), as Show Harmony and Harmony Rule do, and a click on a marker applies its color; 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, all 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, harmony, harmonyRule}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 348ac7b881..900e6b848a 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -528,6 +528,9 @@ font-technology Variable Променливи Color Group: Цветова група: Color Group: {name} Цветова група: {name} Color Guide Цветови водач + Show Harmony Показване на хармонията + Harmony Rule Правило за хармония + Harmony color Цвят от хармонията Color Guide Options Опции на цветовия водач Color Guide Options… Опции на цветовия водач… Color images Цветни изображения diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 3b1a9e001c..59c7924adb 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -729,6 +729,9 @@ Brushes Četkice Color Boja Color Guide Vodič za boje + Show Harmony Prikaži harmoniju + Harmony Rule Pravilo harmonije + Harmony color Boja harmonije Color Themes Teme boja Color Wheel Kotač boja Hue ring Prsten nijanse diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 488b46c4f5..73cbc444c5 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -786,6 +786,9 @@ antiAlias Sharp Nítid Color Group: Grup de colors: Color Group: {name} Grup de colors: {name} Color Guide Guia de colors + Show Harmony Mostra l’harmonia + Harmony Rule Regla d’harmonia + Harmony color Color de l’harmonia Color Guide Options Opcions de la guia de colors Color Guide Options… Opcions de la guia de colors… Color Halftone Semitons de color diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 6a57e90e37..152b73fc73 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -742,6 +742,9 @@ Brushes Štětce Color Barva Color Guide Průvodce barvami + Show Harmony Zobrazit harmonii + Harmony Rule Pravidlo harmonie + Harmony color Barva harmonie Color Themes Barevné motivy Color Wheel Barevné kolo Hue ring Prstenec odstínů diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 54a79e38e5..9f1d2d170b 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -687,6 +687,9 @@ Brushes Pensler Color Farve Color Guide Farveguide + Show Harmony Vis harmoni + Harmony Rule Harmoniregel + Harmony color Harmonifarve Color Themes Farvetemaer Color Wheel Farvehjul Hue ring Ring for farvetone diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index ab77cb0dd7..70fe02fd94 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -521,6 +521,9 @@ font-technology Variable Variabel Color Group: Farbgruppe: Color Group: {name} Farbgruppe: {name} Color Guide Farbhilfe + Show Harmony Harmonie einblenden + Harmony Rule Harmonieregel + Harmony color Harmoniefarbe Color Guide Options Farbhilfeoptionen Color Guide Options… Farbhilfeoptionen… Color images Farbbilder diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index a1a203a257..d3ffdb97ab 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -503,6 +503,9 @@ font-technology Variable Μεταβλητές Color Group: Ομάδα χρωμάτων: Color Group: {name} Ομάδα χρωμάτων: {name} Color Guide Οδηγός χρωμάτων + Show Harmony Εμφάνιση αρμονίας + Harmony Rule Κανόνας χρωματικής αρμονίας + Harmony color Χρώμα αρμονίας Color Guide Options Επιλογές οδηγού χρωμάτων Color Guide Options… Επιλογές οδηγού χρωμάτων… Color images Έγχρωμες εικόνες diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 45fd0d8235..96142a79c4 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -543,6 +543,9 @@ font-technology Variable Variables Color Group: Grupo de colores: Color Group: {name} Grupo de colores: {name} Color Guide Guía de color + Show Harmony Mostrar armonía + Harmony Rule Regla de armonía + Harmony color Color de la armonía Color Guide Options Opciones de guía de color Color Guide Options… Opciones de guía de color… Color images Imágenes en color diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index f6db5b8ee1..ebe701d09d 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -733,6 +733,9 @@ Brushes Siveltimet Color Väri Color Guide Väriopas + Show Harmony Näytä harmonia + Harmony Rule Harmoniasääntö + Harmony color Harmonian väri Color Themes Väriteemat Color Wheel Väriympyrä Hue ring Sävyrengas diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index ae0bf3b436..5463c93389 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -544,6 +544,9 @@ font-technology Variable Variables Color Group: Groupe de couleurs : Color Group: {name} Groupe de couleurs : {name} Color Guide Guide des couleurs + Show Harmony Afficher l’harmonie + Harmony Rule Règle d’harmonie + Harmony color Couleur de l’harmonie Color Guide Options Options du guide des couleurs Color Guide Options… Options du guide des couleurs… Color images Images couleur diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index f38612601c..d84946618d 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -619,6 +619,9 @@ Color Group: રંગ ગ્રૂપ: Color Group: {name} રંગ ગ્રૂપ: {name} Color Guide રંગ ગાઇડ + Show Harmony હાર્મની બતાવો + Harmony Rule હાર્મની નિયમ + Harmony color હાર્મની રંગ Color Guide Options રંગ ગાઇડ વિકલ્પો Color Guide Options… રંગ ગાઇડ વિકલ્પો… Color Halftone… કલર હાફટોન… diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 624671acca..f753f7a905 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -910,6 +910,9 @@ antiAlias Sharp शार्प Color Group: रंग समूह: Color Group: {name} रंग समूह: {name} Color Guide रंग गाइड + Show Harmony सद्भाव दिखाएँ + Harmony Rule सद्भाव नियम + Harmony color सद्भाव रंग Color Guide Options रंग गाइड ऑप्शन्स Color Guide Options… रंग गाइड ऑप्शन्स… Color Halftone कलर हाफ़टोन diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 3e8a200697..bd537e4687 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -716,6 +716,9 @@ font-technology Variable Változó Color Group: Színcsoport: Color Group: {name} Színcsoport: {name} Color Guide Színkalauz + Show Harmony Harmónia megjelenítése + Harmony Rule Harmóniaszabály + Harmony color Harmóniaszín Color Guide Options Színkalauz beállításai Color Guide Options… Színkalauz beállításai… Color Halftone Színes rácspontos raszter diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 2107a23bf0..fc04435908 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -687,6 +687,9 @@ Brushes Kuas Color Warna Color Guide Panduan warna + Show Harmony Tampilkan harmoni + Harmony Rule Aturan harmoni + Harmony color Warna harmoni Color Themes Tema warna Color Wheel Roda warna Hue ring Cincin rona diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index f75dc629db..96f65af153 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -543,6 +543,9 @@ font-technology Variable Variabili Color Group: Gruppo colori: Color Group: {name} Gruppo colori: {name} Color Guide Guida colori + Show Harmony Mostra armonia + Harmony Rule Regola di armonia + Harmony color Colore dell’armonia Color Guide Options Opzioni guida colori Color Guide Options… Opzioni guida colori… Color images Immagini a colori diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 67072cc8b3..1422026697 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -757,6 +757,9 @@ digits Malayalam マラヤーラム数字 Brushes ブラシ Color カラー Color Guide カラーガイド + Show Harmony ハーモニーを表示 + Harmony Rule ハーモニールール + Harmony color ハーモニーカラー Color Themes カラーテーマ Color Wheel カラーホイール Hue ring 色相リング diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index c8513b84c3..5498471a46 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -653,6 +653,9 @@ Brushes ფუნჯები Color ფერი Color Guide ფერის გზამკვლევი + Show Harmony ჰარმონიის ჩვენება + Harmony Rule ჰარმონიის წესი + Harmony color ჰარმონიის ფერი Color Themes ფერის თემები Color Wheel ფერთა წრე Hue ring ფერის ტონის რგოლი diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 8aa0bc41ca..2fd94217b8 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -750,6 +750,9 @@ digits Malayalam 말라얄람어 Brushes 브러시 Color 색상 Color Guide 색상 가이드 + Show Harmony 하모니 표시 + Harmony Rule 하모니 규칙 + Harmony color 하모니 색상 Color Themes 색상 테마 Color Wheel 색상환 Hue ring 색조 링 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index de5b7a3cf6..e0e0fe5eb2 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1205,6 +1205,9 @@ Brushes Penseel Color Kleur Color Guide Kleurhulp + Show Harmony Harmonie tonen + Harmony Rule Harmonieregel + Harmony color Harmoniekleur Color Themes Kleurthema's Color Wheel Kleurenwiel Hue ring Tintring diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index f9bdc664f1..dec8efdb5e 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -691,6 +691,9 @@ Brushes Pędzle Color Kolor Color Guide Przewodnik kolorów + Show Harmony Pokaż harmonię + Harmony Rule Reguła harmonii + Harmony color Kolor harmonii Color Themes Motywy kolorów Color Wheel Koło kolorów Hue ring Pierścień barwy diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 07cd9c6fd6..604677edda 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -495,6 +495,9 @@ antiAlias Sharp Nítido Color Group: Grupo de Cores: Color Group: {name} Grupo de Cores: {name} Color Guide Guia de Cores + Show Harmony Mostrar Harmonia + Harmony Rule Regra de Harmonia + Harmony color Cor da harmonia Color Guide Options Opções do Guia de Cores Color Guide Options… Opções do Guia de Cores… Color Library… Biblioteca de Cores… diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index fcf44192cd..94556c01c3 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -541,6 +541,9 @@ font-technology Variable Вариативные Color Group: Цветовая группа: Color Group: {name} Цветовая группа: {name} Color Guide Цветовой гид + Show Harmony Показать гармонию + Harmony Rule Правило гармонии + Harmony color Цвет гармонии Color Guide Options Параметры цветового гида Color Guide Options… Параметры цветового гида… Color images Цветные изображения diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index d68878734e..c58aa1bb3b 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -530,6 +530,9 @@ font-technology Variable Variabla Color Group: Färggrupp: Color Group: {name} Färggrupp: {name} Color Guide Färgguide + Show Harmony Visa harmoni + Harmony Rule Harmoniregel + Harmony color Harmonifärg Color Guide Options Alternativ för färgguide Color Guide Options… Alternativ för färgguide… Color images Färgbilder diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index b3c88cc563..0a0cf4b5b9 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -525,6 +525,9 @@ font-technology Variable Değişken Color Group: Renk Grubu: Color Group: {name} Renk Grubu: {name} Color Guide Renk Kılavuzu + Show Harmony Uyumu Göster + Harmony Rule Uyum Kuralı + Harmony color Uyum rengi Color Guide Options Renk Kılavuzu Seçenekleri Color Guide Options… Renk Kılavuzu Seçenekleri… Color images Renkli görseller diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 0ab6257df4..c1dbf4621f 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -537,6 +537,9 @@ font-technology Variable Варіативні Color Group: Колірна група: Color Group: {name} Колірна група: {name} Color Guide Колірний гід + Show Harmony Показати гармонію + Harmony Rule Правило гармонії + Harmony color Колір гармонії Color Guide Options Параметри колірного гіда Color Guide Options… Параметри колірного гіда… Color images Кольорові зображення diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 80cc4951cf..b91184fbc9 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -628,6 +628,9 @@ font-technology Variable Biến thiên Color Group: Nhóm màu: Color Group: {name} Nhóm màu: {name} Color Guide Hướng dẫn màu + Show Harmony Hiện hài hòa màu + Harmony Rule Quy tắc hài hòa màu + Harmony color Màu hài hòa Color Guide Options Tùy chọn hướng dẫn màu Color Guide Options… Tùy chọn hướng dẫn màu… Color Halftone Màu nửa tông diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 9561a51baf..f12061b1e3 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -489,6 +489,9 @@ antiAlias Sharp 锐利 Color Group: 颜色组: Color Group: {name} 颜色组:{name} Color Guide 颜色参考 + Show Harmony 显示协调 + Harmony Rule 协调规则 + Harmony color 协调颜色 Color Guide Options 颜色参考选项 Color Guide Options… 颜色参考选项… Color images 彩色图像 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 7489e3d4d9..0b4d25fd04 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -506,6 +506,9 @@ font-technology Variable 可變 Color Group: 顏色群組: Color Group: {name} 顏色群組:{name} Color Guide 色彩參考 + Show Harmony 顯示色彩調和 + Harmony Rule 色彩調和規則 + Harmony color 調和色彩 Color Guide Options 色彩參考選項 Color Guide Options… 色彩參考選項… Color images 彩色影像 diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index d36ecae60f..76f3b17be8 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1325,7 +1325,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "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}", + "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, harmony?: bool, harmonyRule?: complementary|splitComplementary|leftComplement|rightComplement|analogous|analogous2|triad|tetrad|tetrad2|tetrad3|compound|compound2|highContrast|highContrast3|pentagram} 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); harmony shows a marker on the wheel's ring for each other color of harmonyRule (the Color Guide's rule of that id; a rule's label is taken too), as Show Harmony and Harmony Rule do, and a click on a marker applies its color; 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, all 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, harmony, harmonyRule}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index d12c89d2af..115835f1ca 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -698,6 +698,8 @@ mod tests_color_wheel; #[cfg(test)] mod tests_color_wheel_box; #[cfg(test)] +mod tests_color_wheel_harmony; +#[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 31522578e5..507be0c734 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -11,11 +11,17 @@ //! 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`). +//! +//! Show Harmony puts a marker on the ring for each other color of the harmony rule picked under +//! Harmony Rule (the Color Guide's rules whose colors each have a hue of their own), filled with +//! that color. The markers follow the current color, and a click on one applies its color as a +//! pick does. Both settings are kept with the preferences. use egui::{Ui, UiBuilder, vec2}; use serde::{Deserialize, Serialize}; use serde_json::{Value, json}; use vectorcraft_color::cms::{self, Cms}; +use vectorcraft_color::harmony::Harmony; use vectorcraft_color::{Color, Paint, hsb_to_rgb, rgb_to_hsb}; use vectorcraft_doc::{ColorMode, NodeId}; @@ -60,13 +66,50 @@ impl View { /// 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)] +#[derive(Clone, Debug, 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, + /// Show Harmony: markers on the ring for the other colors of `harmony_rule`. + #[serde(deserialize_with = "deserialize_flag")] + pub harmony: bool, + /// The rule of Show Harmony, one of [`harmony_rules`]. + #[serde(serialize_with = "serialize_rule", deserialize_with = "deserialize_rule")] + pub harmony_rule: Harmony, +} + +impl Default for Settings { + fn default() -> Self { + Self { view: View::default(), channel: Channel::default(), harmony: false, harmony_rule: Harmony::Complementary } + } +} + +/// The harmony rules the wheel shows: those whose colors each have a hue of their own, so that no +/// two markers sit at the same place on the ring. +pub fn harmony_rules() -> impl Iterator { + Harmony::ALL.into_iter().filter(|h| h.hues_differ()) +} + +/// The wheel's harmony rule named by `s`, its id or its label. +fn parse_rule(s: &str) -> Option { + Harmony::parse(s).filter(|h| h.hues_differ()) +} + +fn deserialize_flag<'de, D: serde::Deserializer<'de>>(d: D) -> Result { + let v = ::deserialize(d)?; + Ok(v.as_bool().unwrap_or_default()) +} + +fn serialize_rule(h: &Harmony, s: S) -> Result { + s.serialize_str(&h.id()) +} + +fn deserialize_rule<'de, D: serde::Deserializer<'de>>(d: D) -> Result { + let v = ::deserialize(d)?; + Ok(v.as_str().and_then(parse_rule).unwrap_or(Harmony::Complementary)) } fn deserialize_view<'de, D: serde::Deserializer<'de>>(d: D) -> Result { @@ -90,11 +133,12 @@ pub fn deserialize_settings<'de, D: serde::Deserializer<'de>>(d: D) -> Result Result { - const KEYS: [&str; 2] = ["view", "channel"]; + const KEYS: [&str; 4] = ["view", "channel", "harmony", "harmonyRule"]; match p { Value::Null => {} Value::Object(o) => { @@ -113,11 +157,27 @@ pub(crate) fn command(app: &mut VectorcraftApp, p: &Value) -> Result {} Some(v) => set.channel = v.as_str().and_then(Channel::parse).ok_or("`channel` must be hue, saturation, brightness, red, green or blue")?, } + let key = "harmony"; + match p.get(key) { + None | Some(Value::Null) => {} + Some(v) => set.harmony = v.as_bool().ok_or_else(|| format!("`{key}` must be true or false"))?, + } + let key = "harmonyRule"; + match p.get(key) { + None | Some(Value::Null) => {} + Some(v) => { + set.harmony_rule = v.as_str().and_then(parse_rule).ok_or_else(|| { + let ids: Vec = harmony_rules().map(Harmony::id).collect(); + format!("`{key}` must be one of {}", ids.join(", ")) + })? + } + } 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. +/// The panel menu: Wheel View and Box View, and Box Channel while the box shows; Show Harmony +/// while the wheel shows, and Harmony Rule. 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)] { @@ -134,6 +194,17 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { } }); }); + ui.separator(); + if menu_item(ui, tl!("Show Harmony"), set.view == View::Wheel, set.harmony) { + command(app, &json!({ "harmony": !set.harmony })).ok(); + } + ui.menu_button(format!(" {}", tl!("Harmony Rule")), |ui| { + for rule in harmony_rules() { + if menu_item(ui, rule.label(), true, rule == set.harmony_rule) { + command(app, &json!({ "harmonyRule": rule.id() })).ok(); + } + } + }); } /// The display values of HSB `hsb` in `ch`'s space, from 0 to 1: hue, saturation and brightness, @@ -332,6 +403,16 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { if let Some((h, phase)) = ring.hue { pick = Some(([h, hsb[1], hsb[2]], phase)); } + // Show Harmony: the rule's other colors for the current one, which follow it. + let set = &app.ui.color_wheel; + if set.harmony && marked { + let others: Vec<[f32; 3]> = set.harmony_rule.apply_hsb(hsb).into_iter().skip(1).collect(); + if let Some(i) = widgets::ring_markers(ui, "color-wheel-harmony", ring.rect, &others, tl!("Harmony color")) + && let Some(&c) = others.get(i) + { + pick = Some((c, Live::Released)); + } + } // A press between the square and the ring picks the closest point of the square, which // takes the keyboard focus. if let Some((p, phase)) = ring.inner { diff --git a/crates/ui-egui/src/panels/tests_color_wheel_box.rs b/crates/ui-egui/src/panels/tests_color_wheel_box.rs index d3866fd5d9..91dc692050 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_box.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_box.rs @@ -167,16 +167,22 @@ fn the_strip_takes_the_arrow_keys_and_screen_readers_actions() { #[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 harmony = json!({"harmony": false, "harmonyRule": "complementary"}); + let with = |v: serde_json::Value| { + let mut v = v; + v.as_object_mut().unwrap().extend(harmony.as_object().unwrap().clone()); + v + }; + assert_eq!(app.run("ui.colorWheel", json!({})).unwrap(), with(json!({"view": "wheel", "channel": "hue"}))); + assert_eq!(app.run("ui.colorWheel", json!({"view": "box"})).unwrap(), with(json!({"view": "box", "channel": "hue"}))); + assert_eq!(app.run("ui.colorWheel", json!({"channel": "green"})).unwrap(), with(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"); + assert_eq!(app.ui.color_wheel, Settings { view: View::Box, channel: Channel::Green, ..Default::default() }, "an error changes nothing"); let ui = crate::control::inspect(&app, &egui::Context::default()); - assert_eq!(ui["ui"]["color_wheel"], json!({"view": "box", "channel": "green"})); + assert_eq!(ui["ui"]["color_wheel"], with(json!({"view": "box", "channel": "green"}))); } /// The command's errors are translated in the catalogs that translate status and error messages, @@ -211,10 +217,10 @@ fn ui_color_wheel_rejects_other_params() { 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"); + assert_eq!(e, "unknown parameter `veiw`; the command takes: view, channel, harmony, harmonyRule"); 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"); + assert_eq!(e, "unknown parameter `chanel`; the command takes: view, channel, harmony, harmonyRule"); + assert_eq!(app.ui.color_wheel, Settings { view: View::Box, channel: Channel::Red, ..Default::default() }, "an error changes nothing"); } /// With None there is no color to edit: the strip reads 0 to screen readers, as the hue ring does, @@ -249,7 +255,11 @@ fn ui_color_wheel_answers_junk_params_without_a_panic() { /// 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 ui = crate::UiState { + color_wheel: Settings { view: View::Box, channel: Channel::Blue, ..Default::default() }, + 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); @@ -262,11 +272,11 @@ fn the_settings_are_kept_and_read_leniently() { 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() }); + assert_eq!(back.color_wheel, Settings { view: View::Box, channel: Channel::default(), ..Default::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 }); + assert_eq!(back.color_wheel, Settings { view: View::Wheel, channel: Channel::Blue, ..Default::default() }); let mut odd = saved; odd["color_wheel"] = json!("box"); let back: crate::UiState = serde_json::from_value(odd).unwrap(); diff --git a/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs b/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs new file mode 100644 index 0000000000..589304daac --- /dev/null +++ b/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs @@ -0,0 +1,330 @@ +//! The Color Wheel panel's Show Harmony drawn headless: the markers of a rule's other colors on the +//! ring, what a click, Alt, Enter and a screen reader do with them, `ui.colorWheel`'s `harmony` and +//! `harmonyRule`, the panel menu and the saved settings. + +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_color::harmony::Harmony; +use vectorcraft_engine::Session; + +use super::color_wheel::{Settings, View, display_hsb, harmony_rules, show}; +use crate::VectorcraftApp; + +/// An app with a selected rectangle filled with `fill`, its Color Wheel panel showing `rule`. +fn app(fill: serde_json::Value, rule: &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!({"harmony": true, "harmonyRule": rule})).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 +} + +/// The hue (degrees counterclockwise from 3 o'clock) of point `p` on the ring drawn in `ring`. +fn hue_at(ring: Rect, p: Pos2) -> f32 { + let v = p - ring.center(); + (-v.y).atan2(v.x).to_degrees().rem_euclid(360.0) +} + +/// The point at hue `deg` in the middle of the band of the ring drawn in `ring`. +fn on_ring(ring: Rect, deg: f32) -> Pos2 { + let r = ring.width() / 2.0 - 4.0 - 7.0; + let a = deg.to_radians(); + ring.center() + vec2(a.cos(), -a.sin()) * r +} + +/// The centers of the harmony markers, in the rule's order. +fn markers(h: &Harness<'static, VectorcraftApp>) -> Vec { + h.query_all_by_label("Harmony color").map(|n| n.rect().center()).collect() +} + +fn ring(h: &Harness<'static, VectorcraftApp>) -> Rect { + h.get_by_label("Hue ring").rect() +} + +fn press(h: &mut Harness<'static, VectorcraftApp>, pos: Pos2, pressed: bool, modifiers: Modifiers) { + h.event(Event::ModifiersChanged(modifiers)); + h.event(Event::PointerMoved(pos)); + h.event(Event::PointerButton { pos, button: PointerButton::Primary, pressed, modifiers }); + h.run_steps(1); +} + +fn click(h: &mut Harness<'static, VectorcraftApp>, pos: Pos2, modifiers: Modifiers) { + press(h, pos, true, modifiers); + press(h, pos, false, modifiers); + h.event(Event::ModifiersChanged(Modifiers::NONE)); + 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, Modifiers::NONE); + for p in points { + for _ in 0..2 { + h.event(Event::PointerMoved(*p)); + h.run_steps(1); + } + } + press(h, *last, false, Modifiers::NONE); + 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 undo_len(app: &VectorcraftApp) -> usize { + app.session.doc().unwrap().history.undo.len() +} + +/// With the complementary rule and a red fill, a marker sits at 180° on the ring, and a click on it +/// sets the fill to the complement that the rule gives, as one undo step. +#[test] +fn a_complementary_marker_sits_opposite_and_a_click_applies_it() { + let mut h = harness(app(json!("#ff0000"), "complementary")); + let at = markers(&h); + assert_eq!(at.len(), 1, "one other color"); + assert!((hue_at(ring(&h), at[0]) - 180.0).abs() < 1.0, "{}", hue_at(ring(&h), at[0])); + assert_eq!(h.get_by_label("Harmony color").value().as_deref(), Some("#00ffff")); + let undo = undo_len(h.state()); + click(&mut h, at[0], Modifiers::NONE); + let want = Harmony::Complementary.apply(Color::rgb(1.0, 0.0, 0.0))[1]; + assert_eq!(fill(h.state()).to_hex(), want.to_hex()); + assert_eq!(undo_len(h.state()), undo + 1); +} + +/// A click on a High Contrast marker applies the rule's color, whose brightness differs from the +/// current one, and not the hue under the pointer at the current brightness. +#[test] +fn a_click_on_a_marker_applies_the_rules_color_not_the_hue_under_it() { + let mut h = harness(app(json!([0.9, 0.8, 0.2]), "highContrast")); + let base = hsb(&fill(h.state())); + let at = markers(&h); + assert_eq!(at.len(), 1); + click(&mut h, at[0], Modifiers::NONE); + let want = Harmony::HighContrast.apply_hsb(base)[1]; + let got = hsb(&fill(h.state())); + assert!((got[2] - want[2]).abs() < 0.01 && got[2] < 0.5, "{got:?} {want:?}"); + assert!((got[0] - want[0]).abs() < 1.0, "{got:?} {want:?}"); +} + +/// Dragging the current color around the ring moves the other markers by the same angle. +#[test] +fn the_markers_follow_the_current_color() { + let mut h = harness(app(json!("#ff0000"), "triad")); + let r = ring(&h); + let before: Vec = markers(&h).iter().map(|p| hue_at(r, *p)).collect(); + assert_eq!(before.len(), 2); + assert!((before[0] - 120.0).abs() < 1.0 && (before[1] - 240.0).abs() < 1.0, "{before:?}"); + drag(&mut h, &[on_ring(r, 0.0), on_ring(r, 30.0), on_ring(r, 60.0)]); + assert!((hsb(&fill(h.state()))[0] - 60.0).abs() < 1.0, "{:?}", hsb(&fill(h.state()))); + let after: Vec = markers(&h).iter().map(|p| hue_at(r, *p)).collect(); + assert!((after[0] - 180.0).abs() < 1.0 && (after[1] - 300.0).abs() < 1.0, "{after:?}"); +} + +/// A drag that starts on a harmony marker moves the ring's hue as a drag on the band does, as one +/// undo step. +#[test] +fn a_drag_from_a_marker_moves_the_hue() { + let mut h = harness(app(json!("#ff0000"), "triad")); + let r = ring(&h); + let at = markers(&h); + assert!((hue_at(r, at[0]) - 120.0).abs() < 1.0); + let undo = undo_len(h.state()); + drag(&mut h, &[at[0], on_ring(r, 135.0), on_ring(r, 150.0)]); + assert!((hsb(&fill(h.state()))[0] - 150.0).abs() < 1.0, "{:?}", hsb(&fill(h.state()))); + assert_eq!(undo_len(h.state()), undo + 1); +} + +/// Alt-click on a marker paints the stroke, and the fill stays in front. +#[test] +fn alt_click_on_a_marker_paints_the_stroke() { + let mut app = app(json!("#ff0000"), "complementary"); + app.run("paint.setStroke", json!({"color": "#808080", "focus": false})).unwrap(); + let mut h = harness(app); + let at = markers(&h); + click(&mut h, at[0], Modifiers::ALT); + let (f, s) = crate::panels::current_paints(h.state()); + assert_eq!((f.color().unwrap().to_hex(), s.color().unwrap().to_hex()), ("#ff0000".into(), "#00ffff".into())); + assert!(h.state().session.fill_active); +} + +/// A click gives a marker the keyboard focus, and Enter or Space then applies its color; a screen +/// reader's click applies it too. +#[test] +fn the_markers_take_enter_space_and_a_screen_readers_click() { + let mut h = harness(app(json!("#ff0000"), "splitComplementary")); + let at = markers(&h); + assert_eq!(at.len(), 2); + click(&mut h, at[0], Modifiers::NONE); + assert!((hsb(&fill(h.state()))[0] - 150.0).abs() < 1.0, "{:?}", hsb(&fill(h.state()))); + // The markers moved with the color: from 150°, the focused first one is at 300°. + let undo = undo_len(h.state()); + h.key_press_modifiers(Modifiers::NONE, egui::Key::Enter); + h.run_steps(1); + assert!((hsb(&fill(h.state()))[0] - 300.0).abs() < 1.0, "{:?}", hsb(&fill(h.state()))); + h.key_press_modifiers(Modifiers::NONE, egui::Key::Space); + h.run_steps(1); + assert!((hsb(&fill(h.state()))[0] - 90.0).abs() < 1.0, "{:?}", hsb(&fill(h.state()))); + assert_eq!(undo_len(h.state()), undo + 2, "one undo step a key"); + let node = h.get_all_by_label("Harmony color").nth(1).unwrap(); + assert!(node.accesskit_node().data().supports_action(egui::accesskit::Action::Click)); + node.click_accesskit(); + h.run_steps(2); + assert!((hsb(&fill(h.state()))[0] - 300.0).abs() < 1.0, "{:?}", hsb(&fill(h.state()))); +} + +/// No markers show with Show Harmony off, in the box view, or with no color to edit. +#[test] +fn markers_show_only_on_the_wheel_with_a_color() { + let mut a = app(json!("#ff0000"), "triad"); + a.run("ui.colorWheel", json!({"harmony": false})).unwrap(); + assert!(markers(&harness(a)).is_empty()); + let mut a = app(json!("#ff0000"), "triad"); + a.run("ui.colorWheel", json!({"view": "box"})).unwrap(); + assert!(markers(&harness(a)).is_empty()); + let mut a = app(json!("#ff0000"), "triad"); + a.run("paint.setFill", json!({"none": true})).unwrap(); + assert!(markers(&harness(a)).is_empty()); +} + +/// A gray keeps the hue it was picked at, and its markers stay apart around the ring. +#[test] +fn a_gray_markers_turn_from_its_hue() { + let mut h = harness(app(json!([0.3, 0.6, 0.9]), "tetrad2")); + let r = ring(&h); + let hue = hsb(&fill(h.state()))[0]; + let sq = h.get_by_label("Saturation and brightness").rect(); + // A press between the square and the ring picks the square's left edge: no saturation. + click(&mut h, Pos2::new(sq.left() - 3.0, sq.center().y), Modifiers::NONE); + assert_eq!(hsb(&fill(h.state()))[1], 0.0, "a gray"); + let hues: Vec = markers(&h).iter().map(|p| hue_at(r, *p)).collect(); + assert_eq!(hues.len(), 3); + for (got, turn) in hues.iter().zip([90.0, 180.0, 270.0]) { + assert!(((got - hue - turn).rem_euclid(360.0) + 0.5).rem_euclid(360.0) < 2.0, "{hue} {hues:?}"); + } +} + +/// `ui.colorWheel` sets and answers `harmony` and `harmonyRule`, takes a rule's label as well as its +/// id, and answers an error that changes nothing for a value that is not a boolean or a rule +/// outside the wheel's list. +#[test] +fn ui_color_wheel_sets_the_harmony_and_its_rule() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + let got = app.run("ui.colorWheel", json!({"harmony": true, "harmonyRule": "Split Complementary"})).unwrap(); + assert_eq!((got["harmony"].clone(), got["harmonyRule"].clone()), (json!(true), json!("splitComplementary"))); + let e = app.run("ui.colorWheel", json!({"harmony": "yes"})).unwrap_err(); + assert_eq!(e, "`harmony` must be true or false"); + let e = app.run("ui.colorWheel", json!({"view": "box", "harmonyRule": "monochromatic"})).unwrap_err(); + assert_eq!( + e, + "`harmonyRule` must be one of complementary, splitComplementary, leftComplement, rightComplement, analogous, analogous2, triad, \ + tetrad, tetrad2, tetrad3, compound, compound2, highContrast, highContrast3, pentagram" + ); + assert_eq!(app.ui.color_wheel, Settings { harmony: true, harmony_rule: Harmony::SplitComplementary, ..Default::default() }, "nothing changed"); + // Turning Show Harmony off and on keeps the rule. + app.run("ui.colorWheel", json!({"harmony": false})).unwrap(); + let got = app.run("ui.colorWheel", json!({"harmony": true})).unwrap(); + assert_eq!(got["harmonyRule"], json!("splitComplementary")); +} + +/// The errors are translated in the catalogs that translate status and error messages, and each +/// translation keeps the key and the accepted values. +#[test] +fn ui_color_wheel_harmony_errors_are_translated() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + let flag = app.run("ui.colorWheel", json!({"harmony": 1})).unwrap_err(); + let rule = app.run("ui.colorWheel", json!({"harmonyRule": "shades"})).unwrap_err(); + 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"); + let shown = crate::i18n::message(lang, &flag); + assert!(shown != flag && shown.contains("`harmony`"), "{code}: {shown}"); + let shown = crate::i18n::message(lang, &rule); + assert!(shown != rule && shown.contains("`harmonyRule`") && shown.contains("highContrast3"), "{code}: {shown}"); + } +} + +/// The wheel offers the fifteen rules whose colors each have a hue of their own. +#[test] +fn the_wheel_offers_fifteen_rules_without_monochromatic() { + let rules: Vec = harmony_rules().collect(); + assert_eq!(rules.len(), 15); + assert!(!rules.contains(&Harmony::Monochromatic) && !rules.contains(&Harmony::Triad2)); + assert!(rules.contains(&Harmony::Pentagram) && rules.contains(&Harmony::HighContrast3)); +} + +/// The settings survive a JSON round trip of the preferences, and a saved value this build does +/// not know, or a rule the wheel leaves out, reads as the key's default. +#[test] +fn the_harmony_settings_are_kept_and_read_leniently() { + let set = Settings { view: View::Wheel, harmony: true, harmony_rule: Harmony::Pentagram, ..Default::default() }; + let ui = crate::UiState { color_wheel: set.clone(), color_rgb_percent: true, ..Default::default() }; + let saved = serde_json::to_value(&ui).unwrap(); + assert_eq!(saved["color_wheel"]["harmonyRule"], json!("pentagram")); + let back: crate::UiState = serde_json::from_value(saved.clone()).unwrap(); + assert_eq!(back.color_wheel, set); + let mut odd = saved; + odd["color_wheel"]["harmony"] = json!("yes"); + odd["color_wheel"]["harmonyRule"] = json!("monochromatic"); + let back: crate::UiState = serde_json::from_value(odd).unwrap(); + assert_eq!((back.color_wheel.harmony, back.color_wheel.harmony_rule), (false, Harmony::Complementary)); + assert!(back.color_rgb_percent, "the other preferences are kept"); +} + +/// The panel menu's Show Harmony is checked while on and gray while the box shows, and Harmony Rule +/// lists the wheel's rules with the current one checked; its items set the rule. +#[test] +fn the_panel_menu_shows_the_harmony_and_picks_the_rule() { + let a = app(json!("#ff0000"), "triad"); + let mut fonts = false; + let mut h = Harness::builder().with_size(vec2(260.0, 600.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)); + }, + a, + ); + h.run_steps(3); + assert!(!h.get_by_label("✓ Show Harmony").accesskit_node().data().is_disabled()); + h.get_by_label(" Harmony Rule").click(); + h.run_steps(2); + assert!(h.query_by_label("✓ Triad").is_some()); + assert!(h.query_by_label(" Pentagram").is_some()); + assert!(h.query_by_label(" Monochromatic").is_none() && h.query_by_label(" Shades").is_none()); + h.get_by_label(" Pentagram").click(); + h.run_steps(2); + assert_eq!(h.state().ui.color_wheel.harmony_rule, Harmony::Pentagram); + h.state_mut().run("ui.colorWheel", json!({"view": "box"})).unwrap(); + h.run_steps(2); + assert!(h.get_by_label("✓ Show Harmony").accesskit_node().data().is_disabled(), "gray while the box shows"); +} diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 2ace2c7a67..5efe87a7f4 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -37,7 +37,7 @@ pub use chips::{ProxyClicks, chip_button, chip_button_named, fill_stroke_proxy, pub use color::{ FieldAxis, Live, RingResponse, SliderValue, 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, segmented_wheel, stepped_area, + hsb32, hue_ring, region_texture, ring_markers, ring_square, segment_color, segmented_wheel, stepped_area, }; 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 f7c1d9365b..dfd59c9af6 100644 --- a/crates/ui-egui/src/widgets/color.rs +++ b/crates/ui-egui/src/widgets/color.rs @@ -917,6 +917,40 @@ pub fn hue_ring(ui: &mut Ui, id: impl std::hash::Hash, name: &str, size: f32, hu out } +/// Markers on a [`hue_ring`] drawn in `rect`, one for each HSB of `colors` at its hue, filled with +/// its color and smaller than the ring's own marker. Each marker is a button that screen readers +/// read as `name` with the color's hex value. A click gives it the keyboard focus, and a click, +/// Enter or Space on the focused marker, or a screen reader's click returns its index. A drag that +/// starts on a marker moves the ring's hue as a drag on the band does. +pub fn ring_markers(ui: &mut Ui, id: &str, rect: Rect, colors: &[[f32; 3]], name: &str) -> Option { + let t = Tokens::get(ui.ctx()); + let c = rect.center(); + let mid = rect.width().min(rect.height()) / 2.0 - RING_MARGIN - RING_WIDTH / 2.0; + let radius = RING_WIDTH / 2.0 - 2.0; + let painter = ui.painter_at(rect); + let mut picked = None; + for (i, hsb) in colors.iter().enumerate() { + let p = wheel_pos(c, mid, hsb[0], 1.0); + let resp = ui.interact(Rect::from_center_size(p, Vec2::splat(RING_WIDTH)), id_with(ui.scope_id(), (id, i)), Sense::click()); + focus_on_press(&resp); + let fill = hsb32(*hsb); + painter.circle(p, radius, fill, Stroke::new(1.0, Color32::WHITE)); + painter.circle_stroke(p, radius + 1.0, Stroke::new(1.0, Color32::BLACK)); + if ui.memory(|m| m.has_focus(resp.id)) { + painter.circle_stroke(p, radius + 3.0, Stroke::new(1.0, t.accent)); + } + let hex = format!("#{:02x}{:02x}{:02x}", fill.r(), fill.g(), fill.b()); + resp.widget_info(|| egui::WidgetInfo { + current_text_value: Some(hex.clone()), + ..egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), name) + }); + if resp.clicked() { + picked = Some(i); + } + } + picked +} + /// Hue sectors and saturation rings of the [`segmented_wheel`]: patches 15° of hue by 20% /// saturation wide, the sectors centered on red at 0°. const WHEEL_SECTORS: u32 = 24; diff --git a/docs/mcp.md b/docs/mcp.md index 12c1f38184..7ae37a17b0 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -622,9 +622,12 @@ RGB fields in percent, as a double-click right of an RGB field does, and `false` 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. +shows the wheel again. `{"harmony": true, "harmonyRule": "triad"}` puts a marker on the wheel's ring for each other +color of a Color Guide harmony rule, as Show Harmony and Harmony Rule do; the wheel takes the 15 rules whose colors +each have a hue of their own (not `monochromatic`, `shades`, `complementary2`, `triad2`, `triad3` or +`highContrast2`). 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, harmony, harmonyRule}`, and the +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 e34f814534..71a10834ab 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1596,7 +1596,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Load text styles from another document:** the Character Styles and Paragraph Styles panel menus have Load Character Styles… or Load Paragraph Styles… and Load All Styles…, which copy the styles of a document picked in an open dialog, with the swatches and patterns they paint with, in one undo step (`charStyle.load`, `paraStyle.load`, `textStyle.loadAll`); a style the document already has, under its name or a numbered one, is not added again, any other whose name is taken gets a number, and the file's Normal styles are not loaded. Public reference: [Character and paragraph styles](https://web.archive.org/web/20261015081534/https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html). - **Pasted text styles and their patterns:** Paste, and the symbol, brush, pattern and Libraries imports that add art the same way, place each text style, symbol, pattern and brush after the ones it uses. A character style that paints with a pattern added under a free name ("Dots 2") paints with "Dots 2", and it is not matched to a document style of its name that paints with the document's own "Dots"; it gets a number instead ("Patterned 2"). A symbol whose art paints with such a pattern, and a brush whose art sets type in a renamed style, are added as numbered copies in the same way. Pasting again uses the numbered copies. The help page says pasted art brings the swatches it uses ([help guide, p. 134](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf)); the order and the matching are VectorCraft's own rules. Tests: `pasted_styles_paint_with_the_renamed_pattern_they_use`, `pasted_styles_are_not_matched_to_styles_that_paint_with_another_pattern`, `a_pasted_style_and_the_pattern_whose_tile_uses_it_come_in_together`, `pasted_symbols_are_not_matched_to_symbols_that_paint_with_another_pattern` and `pasted_brushes_are_not_matched_to_brushes_that_use_another_style` in `crates/engine/src/tests/clipboard.rs`. - **Neutral wording:** labels, MCP tool text, docs and packaging use neutral names, and `cargo xtask brands` (part of `cargo xtask ci`) fails on vendor names. -- **Colour, type and file workflows:** Recolor Artwork (dialog with harmonies), Edit Colors, Find & Replace, Change Case, Smart Punctuation, Guides, Lock/Hide Above, Transform Each, Rasterize. +- **Colour, type and file workflows:** Recolor Artwork (dialog with harmonies), Edit Colors, Find & Replace, Change Case, Smart Punctuation, Guides, Lock/Hide Above, Transform Each, Rasterize. The Color Wheel panel's Show Harmony marks the other colors of a harmony rule on the ring, which follow the current color, and a click on a marker applies its color (`ui.colorWheel {harmony, harmonyRule}`). The Libraries panel holds gradients and patterns: its + button adds the selection's fill or stroke gradient or pattern, a gradient or pattern swatch dragged from the Swatches panel is added, and a click paints the selection through the active Fill/Stroke proxy, a pattern bringing its definition and swatch into the document. A spot colour stays a spot colour: the library keeps its ink name and tint, and using it in any document links the paint to that document's spot swatch of that name, adding it when missing (#5812). A right-click on a character style in the Libraries panel offers Apply Character Style, Add to Character Styles, Move to Group, Rename… and Delete ([help page](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/add-and-use-text-and-character-styles-in-libraries.html)): Apply works on the selected type, Add puts the style in the document's character styles without applying it (`library.addToCharacterStyles`), Rename… renames the library's style in place (`library.renameItem`) and Delete removes it from the library only. Opening the menu applies nothing. Tests: `tests::library::a_library_character_style_is_added_to_the_document_without_applying_it`, `library_items_are_renamed_in_place`, `panels::libraries::tests::a_character_style_s_menu_applies_adds_renames_and_deletes`. Object › Lock › All Artwork Above and Object › Hide › All Artwork Above deselect the selected objects they lock or hide, the key object included. From 9d6d9da79ab7fa7ea45afffe69da2efc74c68dc5 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 09:00:30 -0800 Subject: [PATCH 2/2] Color Wheel: a press held on a harmony marker applies its color A press on a harmony marker that is held past the length of a click without leaving the marker no longer drags the hue ring under it: the color stays as it was while the press is held, and releasing it on the marker applies the marker's color, as a click does. A press that leaves the marker still moves the ring's hue. Harmony Rule in the panel menu is gray while the box shows, as Show Harmony is. The catalog rows for Show Harmony, Harmony Rule and Harmony color move next to the other Color Wheel rows. Docs: docs/control-protocol.md lists the harmony and harmonyRule keys of ui.colorWheel, and the Show Harmony sentence in docs/target-app-parity.md moves to the Color Wheel panel entry. --- crates/ui-egui/src/i18n/bg.tsv | 6 +-- crates/ui-egui/src/i18n/bs.tsv | 6 +-- crates/ui-egui/src/i18n/ca.tsv | 6 +-- crates/ui-egui/src/i18n/cs.tsv | 6 +-- crates/ui-egui/src/i18n/da.tsv | 6 +-- crates/ui-egui/src/i18n/de.tsv | 6 +-- crates/ui-egui/src/i18n/el.tsv | 6 +-- crates/ui-egui/src/i18n/es.tsv | 6 +-- crates/ui-egui/src/i18n/fi.tsv | 6 +-- crates/ui-egui/src/i18n/fr.tsv | 6 +-- crates/ui-egui/src/i18n/gu.tsv | 6 +-- crates/ui-egui/src/i18n/hi.tsv | 6 +-- crates/ui-egui/src/i18n/hu.tsv | 6 +-- crates/ui-egui/src/i18n/id.tsv | 6 +-- crates/ui-egui/src/i18n/it.tsv | 6 +-- crates/ui-egui/src/i18n/ja.tsv | 6 +-- crates/ui-egui/src/i18n/ka.tsv | 6 +-- crates/ui-egui/src/i18n/ko.tsv | 6 +-- crates/ui-egui/src/i18n/nl.tsv | 6 +-- crates/ui-egui/src/i18n/pl.tsv | 6 +-- crates/ui-egui/src/i18n/pt-br.tsv | 6 +-- crates/ui-egui/src/i18n/ru.tsv | 6 +-- crates/ui-egui/src/i18n/sv.tsv | 6 +-- crates/ui-egui/src/i18n/tr.tsv | 6 +-- crates/ui-egui/src/i18n/uk.tsv | 6 +-- crates/ui-egui/src/i18n/vi.tsv | 6 +-- crates/ui-egui/src/i18n/zh-hans.tsv | 6 +-- crates/ui-egui/src/i18n/zh-hant.tsv | 6 +-- crates/ui-egui/src/panels/color_wheel.rs | 31 +++++++++----- .../src/panels/tests_color_wheel_harmony.rs | 21 ++++++++++ crates/ui-egui/src/widgets.rs | 6 +-- crates/ui-egui/src/widgets/color.rs | 42 +++++++++++++++---- docs/control-protocol.md | 7 ++-- docs/target-app-parity.md | 4 +- 34 files changed, 169 insertions(+), 110 deletions(-) diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 900e6b848a..4ad026cbb2 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -528,9 +528,6 @@ font-technology Variable Променливи Color Group: Цветова група: Color Group: {name} Цветова група: {name} Color Guide Цветови водач - Show Harmony Показване на хармонията - Harmony Rule Правило за хармония - Harmony color Цвят от хармонията Color Guide Options Опции на цветовия водач Color Guide Options… Опции на цветовия водач… Color images Цветни изображения @@ -565,6 +562,9 @@ font-technology Variable Променливи Box Channel Канал на квадрата Color box Цветови квадрат Color Wheel Options Опции на цветното колело + Show Harmony Показване на хармонията + Harmony Rule Правило за хармония + Harmony color Цвят от хармонията Color Type: Цветен тип: Color: Цвят: Colorize Оцветяване diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 59c7924adb..8202d210fe 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -729,9 +729,6 @@ Brushes Četkice Color Boja Color Guide Vodič za boje - Show Harmony Prikaži harmoniju - Harmony Rule Pravilo harmonije - Harmony color Boja harmonije Color Themes Teme boja Color Wheel Kotač boja Hue ring Prsten nijanse @@ -743,6 +740,9 @@ Box Channel Kanal kvadrata Color box Kvadrat boje Color Wheel Options Opcije kotača boja + Show Harmony Prikaži harmoniju + Harmony Rule Pravilo harmonije + Harmony color Boja harmonije CSS Properties CSS svojstva Document Info Informacije o dokumentu Flattener Preview Pregled spljoštavanja diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 73cbc444c5..39fc7046d1 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -786,9 +786,6 @@ antiAlias Sharp Nítid Color Group: Grup de colors: Color Group: {name} Grup de colors: {name} Color Guide Guia de colors - Show Harmony Mostra l’harmonia - Harmony Rule Regla d’harmonia - Harmony color Color de l’harmonia Color Guide Options Opcions de la guia de colors Color Guide Options… Opcions de la guia de colors… Color Halftone Semitons de color @@ -827,6 +824,9 @@ antiAlias Sharp Nítid Box Channel Canal del quadre Color box Quadre de color Color Wheel Options Opcions de la roda de colors + Show Harmony Mostra l’harmonia + Harmony Rule Regla d’harmonia + Harmony color Color de l’harmonia Color Type: Tipus de color: Color wheel Roda de color Color: Color: diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 152b73fc73..36f19219db 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -742,9 +742,6 @@ Brushes Štětce Color Barva Color Guide Průvodce barvami - Show Harmony Zobrazit harmonii - Harmony Rule Pravidlo harmonie - Harmony color Barva harmonie Color Themes Barevné motivy Color Wheel Barevné kolo Hue ring Prstenec odstínů @@ -756,6 +753,9 @@ Box Channel Kanál čtverce Color box Barevný čtverec Color Wheel Options Možnosti barevného kola + Show Harmony Zobrazit harmonii + Harmony Rule Pravidlo harmonie + Harmony color Barva harmonie CSS Properties Vlastnosti CSS Document Info Informace o dokumentu Flattener Preview Náhled sloučení diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 9f1d2d170b..58c1d493d8 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -687,9 +687,6 @@ Brushes Pensler Color Farve Color Guide Farveguide - Show Harmony Vis harmoni - Harmony Rule Harmoniregel - Harmony color Harmonifarve Color Themes Farvetemaer Color Wheel Farvehjul Hue ring Ring for farvetone @@ -701,6 +698,9 @@ Box Channel Kvadratets kanal Color box Farvekvadrat Color Wheel Options Indstillinger for farvehjul + Show Harmony Vis harmoni + Harmony Rule Harmoniregel + Harmony color Harmonifarve CSS Properties CSS-egenskaber Document Info Dokumentoplysninger Flattener Preview Udjævningsforhåndsvisning diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 70fe02fd94..cb63d0e090 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -521,9 +521,6 @@ font-technology Variable Variabel Color Group: Farbgruppe: Color Group: {name} Farbgruppe: {name} Color Guide Farbhilfe - Show Harmony Harmonie einblenden - Harmony Rule Harmonieregel - Harmony color Harmoniefarbe Color Guide Options Farbhilfeoptionen Color Guide Options… Farbhilfeoptionen… Color images Farbbilder @@ -558,6 +555,9 @@ font-technology Variable Variabel Box Channel Kanal des Quadrats Color box Farbquadrat Color Wheel Options Optionen für den Farbkreis + Show Harmony Harmonie einblenden + Harmony Rule Harmonieregel + Harmony color Harmoniefarbe Color Type: Farbart: Color: Farbe: Colorize Einfärben diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index d3ffdb97ab..66dabc58dd 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -503,9 +503,6 @@ font-technology Variable Μεταβλητές Color Group: Ομάδα χρωμάτων: Color Group: {name} Ομάδα χρωμάτων: {name} Color Guide Οδηγός χρωμάτων - Show Harmony Εμφάνιση αρμονίας - Harmony Rule Κανόνας χρωματικής αρμονίας - Harmony color Χρώμα αρμονίας Color Guide Options Επιλογές οδηγού χρωμάτων Color Guide Options… Επιλογές οδηγού χρωμάτων… Color images Έγχρωμες εικόνες @@ -540,6 +537,9 @@ font-technology Variable Μεταβλητές Box Channel Κανάλι τετραγώνου Color box Τετράγωνο χρώματος Color Wheel Options Επιλογές χρωματικού τροχού + Show Harmony Εμφάνιση αρμονίας + Harmony Rule Κανόνας χρωματικής αρμονίας + Harmony color Χρώμα αρμονίας Color Type: Τύπος χρώματος: Color: Χρώμα: Colorize Χρωματισμός diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 96142a79c4..1b26671108 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -543,9 +543,6 @@ font-technology Variable Variables Color Group: Grupo de colores: Color Group: {name} Grupo de colores: {name} Color Guide Guía de color - Show Harmony Mostrar armonía - Harmony Rule Regla de armonía - Harmony color Color de la armonía Color Guide Options Opciones de guía de color Color Guide Options… Opciones de guía de color… Color images Imágenes en color @@ -580,6 +577,9 @@ font-technology Variable Variables Box Channel Canal del cuadro Color box Cuadro de color Color Wheel Options Opciones de la rueda de color + Show Harmony Mostrar armonía + Harmony Rule Regla de armonía + Harmony color Color de la armonía Color Type: Tipo de color: Color: Color: Colorize Colorear diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index ebe701d09d..2415e314c1 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -733,9 +733,6 @@ Brushes Siveltimet Color Väri Color Guide Väriopas - Show Harmony Näytä harmonia - Harmony Rule Harmoniasääntö - Harmony color Harmonian väri Color Themes Väriteemat Color Wheel Väriympyrä Hue ring Sävyrengas @@ -747,6 +744,9 @@ Box Channel Ruudun kanava Color box Väriruutu Color Wheel Options Väriympyrän asetukset + Show Harmony Näytä harmonia + Harmony Rule Harmoniasääntö + Harmony color Harmonian väri CSS Properties CSS-ominaisuudet Document Info Asiakirjan tiedot Flattener Preview Litistyksen esikatselu diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 5463c93389..36a13bf73c 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -544,9 +544,6 @@ font-technology Variable Variables Color Group: Groupe de couleurs : Color Group: {name} Groupe de couleurs : {name} Color Guide Guide des couleurs - Show Harmony Afficher l’harmonie - Harmony Rule Règle d’harmonie - Harmony color Couleur de l’harmonie Color Guide Options Options du guide des couleurs Color Guide Options… Options du guide des couleurs… Color images Images couleur @@ -581,6 +578,9 @@ font-technology Variable Variables Box Channel Couche du carré Color box Carré de couleur Color Wheel Options Options de la roue chromatique + Show Harmony Afficher l’harmonie + Harmony Rule Règle d’harmonie + Harmony color Couleur de l’harmonie Color Type: Type de couleur : Color: Couleur : Colorize Coloriser diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index d84946618d..d1133c5fd5 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -619,9 +619,6 @@ Color Group: રંગ ગ્રૂપ: Color Group: {name} રંગ ગ્રૂપ: {name} Color Guide રંગ ગાઇડ - Show Harmony હાર્મની બતાવો - Harmony Rule હાર્મની નિયમ - Harmony color હાર્મની રંગ Color Guide Options રંગ ગાઇડ વિકલ્પો Color Guide Options… રંગ ગાઇડ વિકલ્પો… Color Halftone… કલર હાફટોન… @@ -4232,6 +4229,9 @@ Box Channel બૉક્સ ચેનલ Color box રંગ બૉક્સ Color Wheel Options રંગ વ્હીલ વિકલ્પો + Show Harmony હાર્મની બતાવો + Harmony Rule હાર્મની નિયમ + Harmony color હાર્મની રંગ {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 f753f7a905..947bfde3dc 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -910,9 +910,6 @@ antiAlias Sharp शार्प Color Group: रंग समूह: Color Group: {name} रंग समूह: {name} Color Guide रंग गाइड - Show Harmony सद्भाव दिखाएँ - Harmony Rule सद्भाव नियम - Harmony color सद्भाव रंग Color Guide Options रंग गाइड ऑप्शन्स Color Guide Options… रंग गाइड ऑप्शन्स… Color Halftone कलर हाफ़टोन @@ -951,6 +948,9 @@ antiAlias Sharp शार्प Box Channel बॉक्स चैनल Color box कलर बॉक्स Color Wheel Options कलर व्हील ऑप्शन्स + Show Harmony सद्भाव दिखाएँ + Harmony Rule सद्भाव नियम + Harmony color सद्भाव रंग Color Type: रंग का प्रकार: Color wheel कलर व्हील Color: रंग: diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index bd537e4687..f76889dbfe 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -716,9 +716,6 @@ font-technology Variable Változó Color Group: Színcsoport: Color Group: {name} Színcsoport: {name} Color Guide Színkalauz - Show Harmony Harmónia megjelenítése - Harmony Rule Harmóniaszabály - Harmony color Harmóniaszín Color Guide Options Színkalauz beállításai Color Guide Options… Színkalauz beállításai… Color Halftone Színes rácspontos raszter @@ -756,6 +753,9 @@ font-technology Variable Változó Box Channel Négyzet csatornája Color box Színnégyzet Color Wheel Options Színkör beállításai + Show Harmony Harmónia megjelenítése + Harmony Rule Harmóniaszabály + Harmony color Harmóniaszín Color Type: Színtípus: Color: Szín: Colorization Színezés diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index fc04435908..fec6089f30 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -687,9 +687,6 @@ Brushes Kuas Color Warna Color Guide Panduan warna - Show Harmony Tampilkan harmoni - Harmony Rule Aturan harmoni - Harmony color Warna harmoni Color Themes Tema warna Color Wheel Roda warna Hue ring Cincin rona @@ -701,6 +698,9 @@ Box Channel Saluran kotak Color box Kotak warna Color Wheel Options Opsi roda warna + Show Harmony Tampilkan harmoni + Harmony Rule Aturan harmoni + Harmony color Warna harmoni CSS Properties Properti CSS Document Info Info dokumen Flattener Preview Pratinjau perata diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 96f65af153..4f7ee20e21 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -543,9 +543,6 @@ font-technology Variable Variabili Color Group: Gruppo colori: Color Group: {name} Gruppo colori: {name} Color Guide Guida colori - Show Harmony Mostra armonia - Harmony Rule Regola di armonia - Harmony color Colore dell’armonia Color Guide Options Opzioni guida colori Color Guide Options… Opzioni guida colori… Color images Immagini a colori @@ -580,6 +577,9 @@ font-technology Variable Variabili Box Channel Canale del riquadro Color box Riquadro colore Color Wheel Options Opzioni ruota dei colori + Show Harmony Mostra armonia + Harmony Rule Regola di armonia + Harmony color Colore dell’armonia Color Type: Tipo di colore: Color: Colore: Colorize Colora diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 1422026697..424146a107 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -757,9 +757,6 @@ digits Malayalam マラヤーラム数字 Brushes ブラシ Color カラー Color Guide カラーガイド - Show Harmony ハーモニーを表示 - Harmony Rule ハーモニールール - Harmony color ハーモニーカラー Color Themes カラーテーマ Color Wheel カラーホイール Hue ring 色相リング @@ -771,6 +768,9 @@ digits Malayalam マラヤーラム数字 Box Channel ボックスのチャンネル Color box カラーボックス Color Wheel Options カラーホイールオプション + Show Harmony ハーモニーを表示 + Harmony Rule ハーモニールール + Harmony color ハーモニーカラー CSS Properties CSS プロパティ Document Info ドキュメント情報 Flattener Preview 分割・統合プレビュー diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 5498471a46..47ddb4ac57 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -653,9 +653,6 @@ Brushes ფუნჯები Color ფერი Color Guide ფერის გზამკვლევი - Show Harmony ჰარმონიის ჩვენება - Harmony Rule ჰარმონიის წესი - Harmony color ჰარმონიის ფერი Color Themes ფერის თემები Color Wheel ფერთა წრე Hue ring ფერის ტონის რგოლი @@ -667,6 +664,9 @@ Box Channel კვადრატის არხი Color box ფერის კვადრატი Color Wheel Options ფერთა წრის პარამეტრები + Show Harmony ჰარმონიის ჩვენება + Harmony Rule ჰარმონიის წესი + Harmony color ჰარმონიის ფერი CSS Properties CSS თვისებები Document Info დოკუმენტის ინფორმაცია Flattener Preview გაბრტყელების წინასწარი ნახვა diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 2fd94217b8..04d6cd01b7 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -750,9 +750,6 @@ digits Malayalam 말라얄람어 Brushes 브러시 Color 색상 Color Guide 색상 가이드 - Show Harmony 하모니 표시 - Harmony Rule 하모니 규칙 - Harmony color 하모니 색상 Color Themes 색상 테마 Color Wheel 색상환 Hue ring 색조 링 @@ -764,6 +761,9 @@ digits Malayalam 말라얄람어 Box Channel 상자 채널 Color box 색상 상자 Color Wheel Options 색상환 옵션 + Show Harmony 하모니 표시 + Harmony Rule 하모니 규칙 + Harmony color 하모니 색상 CSS Properties CSS 속성 Document Info 문서 정보 Flattener Preview 병합 미리 보기 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index e0e0fe5eb2..5f00a2873b 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1205,9 +1205,6 @@ Brushes Penseel Color Kleur Color Guide Kleurhulp - Show Harmony Harmonie tonen - Harmony Rule Harmonieregel - Harmony color Harmoniekleur Color Themes Kleurthema's Color Wheel Kleurenwiel Hue ring Tintring @@ -1219,6 +1216,9 @@ Box Channel Kanaal van het vak Color box Kleurvak Color Wheel Options Opties voor kleurenwiel + Show Harmony Harmonie tonen + Harmony Rule Harmonieregel + Harmony color Harmoniekleur CSS Properties CSS-eigenschappen Document Info Documentinfo Flattener Preview Afvlakvoorbeeld diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index dec8efdb5e..10d45f0a7d 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -691,9 +691,6 @@ Brushes Pędzle Color Kolor Color Guide Przewodnik kolorów - Show Harmony Pokaż harmonię - Harmony Rule Reguła harmonii - Harmony color Kolor harmonii Color Themes Motywy kolorów Color Wheel Koło kolorów Hue ring Pierścień barwy @@ -705,6 +702,9 @@ Box Channel Kanał kwadratu Color box Kwadrat koloru Color Wheel Options Opcje koła kolorów + Show Harmony Pokaż harmonię + Harmony Rule Reguła harmonii + Harmony color Kolor harmonii CSS Properties Właściwości CSS Document Info Informacje o dokumencie Flattener Preview Podgląd spłaszczania diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 604677edda..ec46478042 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -495,9 +495,6 @@ antiAlias Sharp Nítido Color Group: Grupo de Cores: Color Group: {name} Grupo de Cores: {name} Color Guide Guia de Cores - Show Harmony Mostrar Harmonia - Harmony Rule Regra de Harmonia - Harmony color Cor da harmonia Color Guide Options Opções do Guia de Cores Color Guide Options… Opções do Guia de Cores… Color Library… Biblioteca de Cores… @@ -525,6 +522,9 @@ antiAlias Sharp Nítido Box Channel Canal da Caixa Color box Caixa de cor Color Wheel Options Opções da Roda de Cores + Show Harmony Mostrar Harmonia + Harmony Rule Regra de Harmonia + Harmony color Cor da harmonia Color Type: Tipo de Cor: Color blindness – Deuteranopia-type Daltonismo – tipo deuteranopia Color blindness – Protanopia-type Daltonismo – tipo protanopia diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 94556c01c3..cb76c1b2b0 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -541,9 +541,6 @@ font-technology Variable Вариативные Color Group: Цветовая группа: Color Group: {name} Цветовая группа: {name} Color Guide Цветовой гид - Show Harmony Показать гармонию - Harmony Rule Правило гармонии - Harmony color Цвет гармонии Color Guide Options Параметры цветового гида Color Guide Options… Параметры цветового гида… Color images Цветные изображения @@ -578,6 +575,9 @@ font-technology Variable Вариативные Box Channel Канал квадрата Color box Цветовой квадрат Color Wheel Options Параметры цветового круга + Show Harmony Показать гармонию + Harmony Rule Правило гармонии + Harmony color Цвет гармонии Color Type: Тип цвета: Color: Цвет: Colorize Тонировать diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index c58aa1bb3b..b741a2e5ea 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -530,9 +530,6 @@ font-technology Variable Variabla Color Group: Färggrupp: Color Group: {name} Färggrupp: {name} Color Guide Färgguide - Show Harmony Visa harmoni - Harmony Rule Harmoniregel - Harmony color Harmonifärg Color Guide Options Alternativ för färgguide Color Guide Options… Alternativ för färgguide… Color images Färgbilder @@ -567,6 +564,9 @@ font-technology Variable Variabla Box Channel Rutans kanal Color box Färgruta Color Wheel Options Alternativ för färghjulet + Show Harmony Visa harmoni + Harmony Rule Harmoniregel + Harmony color Harmonifärg Color Type: Färgtyp: Color: Färg: Colorize Färglägg diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 0a0cf4b5b9..8a3d29226d 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -525,9 +525,6 @@ font-technology Variable Değişken Color Group: Renk Grubu: Color Group: {name} Renk Grubu: {name} Color Guide Renk Kılavuzu - Show Harmony Uyumu Göster - Harmony Rule Uyum Kuralı - Harmony color Uyum rengi Color Guide Options Renk Kılavuzu Seçenekleri Color Guide Options… Renk Kılavuzu Seçenekleri… Color images Renkli görseller @@ -561,6 +558,9 @@ font-technology Variable Değişken Box Channel Kutu Kanalı Color box Renk kutusu Color Wheel Options Renk Tekerleği Seçenekleri + Show Harmony Uyumu Göster + Harmony Rule Uyum Kuralı + Harmony color Uyum rengi Color Type: Renk Türü: Color: Renk: Colorize Renklendir diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index c1dbf4621f..b6fde5b6ba 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -537,9 +537,6 @@ font-technology Variable Варіативні Color Group: Колірна група: Color Group: {name} Колірна група: {name} Color Guide Колірний гід - Show Harmony Показати гармонію - Harmony Rule Правило гармонії - Harmony color Колір гармонії Color Guide Options Параметри колірного гіда Color Guide Options… Параметри колірного гіда… Color images Кольорові зображення @@ -574,6 +571,9 @@ font-technology Variable Варіативні Box Channel Канал квадрата Color box Колірний квадрат Color Wheel Options Параметри колірного кола + Show Harmony Показати гармонію + Harmony Rule Правило гармонії + Harmony color Колір гармонії Color Type: Тип кольору: Color: Колір: Colorize Тонувати diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index b91184fbc9..41a93e2d92 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -628,9 +628,6 @@ font-technology Variable Biến thiên Color Group: Nhóm màu: Color Group: {name} Nhóm màu: {name} Color Guide Hướng dẫn màu - Show Harmony Hiện hài hòa màu - Harmony Rule Quy tắc hài hòa màu - Harmony color Màu hài hòa Color Guide Options Tùy chọn hướng dẫn màu Color Guide Options… Tùy chọn hướng dẫn màu… Color Halftone Màu nửa tông @@ -667,6 +664,9 @@ font-technology Variable Biến thiên 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 + Show Harmony Hiện hài hòa màu + Harmony Rule Quy tắc hài hòa màu + Harmony color Màu hài hòa Color Type: Loại màu: Color: Màu: Colorization Tô màu diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index f12061b1e3..af1698026c 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -489,9 +489,6 @@ antiAlias Sharp 锐利 Color Group: 颜色组: Color Group: {name} 颜色组:{name} Color Guide 颜色参考 - Show Harmony 显示协调 - Harmony Rule 协调规则 - Harmony color 协调颜色 Color Guide Options 颜色参考选项 Color Guide Options… 颜色参考选项… Color images 彩色图像 @@ -526,6 +523,9 @@ antiAlias Sharp 锐利 Box Channel 方块色版 Color box 颜色方块 Color Wheel Options 色轮选项 + Show Harmony 显示协调 + Harmony Rule 协调规则 + Harmony color 协调颜色 Color Type: 颜色类型: Color: 颜色: Colorize 上色 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 0b4d25fd04..1d9b5ce1da 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -506,9 +506,6 @@ font-technology Variable 可變 Color Group: 顏色群組: Color Group: {name} 顏色群組:{name} Color Guide 色彩參考 - Show Harmony 顯示色彩調和 - Harmony Rule 色彩調和規則 - Harmony color 調和色彩 Color Guide Options 色彩參考選項 Color Guide Options… 色彩參考選項… Color images 彩色影像 @@ -543,6 +540,9 @@ font-technology Variable 可變 Box Channel 方塊色版 Color box 顏色方塊 Color Wheel Options 色輪選項 + Show Harmony 顯示色彩調和 + Harmony Rule 色彩調和規則 + Harmony color 調和色彩 Color Type: 顏色類型: Color: 顏色: Colorize 上色 diff --git a/crates/ui-egui/src/panels/color_wheel.rs b/crates/ui-egui/src/panels/color_wheel.rs index 507be0c734..9f68d5fc1a 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -177,7 +177,7 @@ pub(crate) fn command(app: &mut VectorcraftApp, p: &Value) -> Result = set.harmony_rule.apply_hsb(hsb).into_iter().skip(1).collect(); - if let Some(i) = widgets::ring_markers(ui, "color-wheel-harmony", ring.rect, &others, tl!("Harmony color")) + let markers = widgets::ring_markers(ui, "color-wheel-harmony", ring.rect, &others, tl!("Harmony color")); + held = markers.held; + if let Some(i) = markers.picked && let Some(&c) = others.get(i) { pick = Some((c, Live::Released)); } } + if let Some((h, phase)) = ring.hue + && !held + && pick.is_none() + { + pick = Some(([h, hsb[1], hsb[2]], phase)); + } // A press between the square and the ring picks the closest point of the square, which // takes the keyboard focus. if let Some((p, phase)) = ring.inner { diff --git a/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs b/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs index 589304daac..454e43ec49 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs @@ -158,6 +158,26 @@ fn a_drag_from_a_marker_moves_the_hue() { assert_eq!(undo_len(h.state()), undo + 1); } +/// A press held on a High Contrast marker past the length of a click, without moving, applies the +/// rule's color on release, and the hue under the pointer is not previewed while it is held. +#[test] +fn a_press_held_on_a_marker_applies_the_rules_color() { + let mut h = harness(app(json!([0.9, 0.8, 0.2]), "highContrast")); + let base = hsb(&fill(h.state())); + let at = markers(&h); + assert_eq!(at.len(), 1); + let undo = undo_len(h.state()); + press(&mut h, at[0], true, Modifiers::NONE); + h.run_steps(6); + assert_eq!(hsb(&fill(h.state())), base, "nothing changes while the press is held"); + press(&mut h, at[0], false, Modifiers::NONE); + h.run_steps(1); + let want = Harmony::HighContrast.apply_hsb(base)[1]; + let got = hsb(&fill(h.state())); + assert!((got[2] - want[2]).abs() < 0.01 && (got[0] - want[0]).abs() < 1.0, "{got:?} {want:?}"); + assert_eq!(undo_len(h.state()), undo + 1); +} + /// Alt-click on a marker paints the stroke, and the fill stays in front. #[test] fn alt_click_on_a_marker_paints_the_stroke() { @@ -327,4 +347,5 @@ fn the_panel_menu_shows_the_harmony_and_picks_the_rule() { h.state_mut().run("ui.colorWheel", json!({"view": "box"})).unwrap(); h.run_steps(2); assert!(h.get_by_label("✓ Show Harmony").accesskit_node().data().is_disabled(), "gray while the box shows"); + assert!(h.get_by_label(" Harmony Rule").accesskit_node().data().is_disabled(), "gray while the box shows"); } diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 5efe87a7f4..0e28a94e79 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -35,9 +35,9 @@ pub(crate) use buttons::{button_width, icon_button_info, primary_button_width, s 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, 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_markers, ring_square, segment_color, segmented_wheel, stepped_area, + FieldAxis, Live, MarkerResponse, RingResponse, SliderValue, 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_markers, ring_square, segment_color, segmented_wheel, stepped_area, }; 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 dfd59c9af6..944e36ad86 100644 --- a/crates/ui-egui/src/widgets/color.rs +++ b/crates/ui-egui/src/widgets/color.rs @@ -917,22 +917,45 @@ pub fn hue_ring(ui: &mut Ui, id: impl std::hash::Hash, name: &str, size: f32, hu out } +/// What [`ring_markers`] did this frame. +#[derive(Clone, Copy, Debug, Default)] +pub struct MarkerResponse { + /// The index of the marker that was picked. + pub picked: Option, + /// A press on a marker is held with the pointer still on the marker. The caller then ignores + /// the drag that the ring under it reports. + pub held: bool, +} + /// Markers on a [`hue_ring`] drawn in `rect`, one for each HSB of `colors` at its hue, filled with /// its color and smaller than the ring's own marker. Each marker is a button that screen readers -/// read as `name` with the color's hex value. A click gives it the keyboard focus, and a click, -/// Enter or Space on the focused marker, or a screen reader's click returns its index. A drag that -/// starts on a marker moves the ring's hue as a drag on the band does. -pub fn ring_markers(ui: &mut Ui, id: &str, rect: Rect, colors: &[[f32; 3]], name: &str) -> Option { +/// read as `name` with the color's hex value. A click gives it the keyboard focus. A click, a +/// press released on the marker however long it was held, Enter or Space on the focused marker, +/// or a screen reader's click picks it. A drag that leaves the marker moves the ring's hue as a +/// drag on the band does. +pub fn ring_markers(ui: &mut Ui, id: &str, rect: Rect, colors: &[[f32; 3]], name: &str) -> MarkerResponse { let t = Tokens::get(ui.ctx()); let c = rect.center(); let mid = rect.width().min(rect.height()) / 2.0 - RING_MARGIN - RING_WIDTH / 2.0; let radius = RING_WIDTH / 2.0 - 2.0; let painter = ui.painter_at(rect); + let press_id = id_with(ui.scope_id(), (id, "press")); + let (pos, down, pressed, released) = + ui.input(|i| (i.pointer.latest_pos(), i.pointer.primary_down(), i.pointer.primary_pressed(), i.pointer.primary_released())); + let mut held_on: Option = ui.data(|d| d.get_temp(press_id)).flatten(); let mut picked = None; for (i, hsb) in colors.iter().enumerate() { let p = wheel_pos(c, mid, hsb[0], 1.0); - let resp = ui.interact(Rect::from_center_size(p, Vec2::splat(RING_WIDTH)), id_with(ui.scope_id(), (id, i)), Sense::click()); + let area = Rect::from_center_size(p, Vec2::splat(RING_WIDTH)); + let resp = ui.interact(area, id_with(ui.scope_id(), (id, i)), Sense::click()); focus_on_press(&resp); + if pressed && resp.is_pointer_button_down_on() { + held_on = Some(i); + } + let on = pos.is_some_and(|p| area.contains(p)); + if held_on == Some(i) && !on { + held_on = None; + } let fill = hsb32(*hsb); painter.circle(p, radius, fill, Stroke::new(1.0, Color32::WHITE)); painter.circle_stroke(p, radius + 1.0, Stroke::new(1.0, Color32::BLACK)); @@ -944,11 +967,16 @@ pub fn ring_markers(ui: &mut Ui, id: &str, rect: Rect, colors: &[[f32; 3]], name current_text_value: Some(hex.clone()), ..egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), name) }); - if resp.clicked() { + if resp.clicked() || (held_on == Some(i) && released && on) { picked = Some(i); } } - picked + if held_on.is_some_and(|i| i >= colors.len()) { + held_on = None; + } + let held = down && held_on.is_some(); + ui.data_mut(|d| d.insert_temp(press_id, if down { held_on } else { None })); + MarkerResponse { picked, held } } /// Hue sectors and saturation rings of the [`segmented_wheel`]: patches 15° of hue by 20% diff --git a/docs/control-protocol.md b/docs/control-protocol.md index bb13e0d5f5..dcb2639bf8 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -265,9 +265,10 @@ 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). `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`. +point (the first stop or point when none is selected). `ui.colorWheel {view?, channel?, harmony?, harmonyRule?}` shows the wheel or the +box (a color field with a channel strip at its right), picks the box's channel, and shows the other colors of a +harmony rule as markers on the wheel's ring; 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/target-app-parity.md b/docs/target-app-parity.md index 71a10834ab..7792b0a272 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1502,7 +1502,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. 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. + - **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. The panel menu's Show Harmony marks the other colors of a harmony rule (Harmony Rule) on the ring; the markers follow the current color, and a click on a marker applies its color (`ui.colorWheel {harmony, harmonyRule}`). 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`. @@ -1596,7 +1596,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Load text styles from another document:** the Character Styles and Paragraph Styles panel menus have Load Character Styles… or Load Paragraph Styles… and Load All Styles…, which copy the styles of a document picked in an open dialog, with the swatches and patterns they paint with, in one undo step (`charStyle.load`, `paraStyle.load`, `textStyle.loadAll`); a style the document already has, under its name or a numbered one, is not added again, any other whose name is taken gets a number, and the file's Normal styles are not loaded. Public reference: [Character and paragraph styles](https://web.archive.org/web/20261015081534/https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html). - **Pasted text styles and their patterns:** Paste, and the symbol, brush, pattern and Libraries imports that add art the same way, place each text style, symbol, pattern and brush after the ones it uses. A character style that paints with a pattern added under a free name ("Dots 2") paints with "Dots 2", and it is not matched to a document style of its name that paints with the document's own "Dots"; it gets a number instead ("Patterned 2"). A symbol whose art paints with such a pattern, and a brush whose art sets type in a renamed style, are added as numbered copies in the same way. Pasting again uses the numbered copies. The help page says pasted art brings the swatches it uses ([help guide, p. 134](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf)); the order and the matching are VectorCraft's own rules. Tests: `pasted_styles_paint_with_the_renamed_pattern_they_use`, `pasted_styles_are_not_matched_to_styles_that_paint_with_another_pattern`, `a_pasted_style_and_the_pattern_whose_tile_uses_it_come_in_together`, `pasted_symbols_are_not_matched_to_symbols_that_paint_with_another_pattern` and `pasted_brushes_are_not_matched_to_brushes_that_use_another_style` in `crates/engine/src/tests/clipboard.rs`. - **Neutral wording:** labels, MCP tool text, docs and packaging use neutral names, and `cargo xtask brands` (part of `cargo xtask ci`) fails on vendor names. -- **Colour, type and file workflows:** Recolor Artwork (dialog with harmonies), Edit Colors, Find & Replace, Change Case, Smart Punctuation, Guides, Lock/Hide Above, Transform Each, Rasterize. The Color Wheel panel's Show Harmony marks the other colors of a harmony rule on the ring, which follow the current color, and a click on a marker applies its color (`ui.colorWheel {harmony, harmonyRule}`). +- **Colour, type and file workflows:** Recolor Artwork (dialog with harmonies), Edit Colors, Find & Replace, Change Case, Smart Punctuation, Guides, Lock/Hide Above, Transform Each, Rasterize. The Libraries panel holds gradients and patterns: its + button adds the selection's fill or stroke gradient or pattern, a gradient or pattern swatch dragged from the Swatches panel is added, and a click paints the selection through the active Fill/Stroke proxy, a pattern bringing its definition and swatch into the document. A spot colour stays a spot colour: the library keeps its ink name and tint, and using it in any document links the paint to that document's spot swatch of that name, adding it when missing (#5812). A right-click on a character style in the Libraries panel offers Apply Character Style, Add to Character Styles, Move to Group, Rename… and Delete ([help page](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/add-and-use-text-and-character-styles-in-libraries.html)): Apply works on the selected type, Add puts the style in the document's character styles without applying it (`library.addToCharacterStyles`), Rename… renames the library's style in place (`library.renameItem`) and Delete removes it from the library only. Opening the menu applies nothing. Tests: `tests::library::a_library_character_style_is_added_to_the_document_without_applying_it`, `library_items_are_renamed_in_place`, `panels::libraries::tests::a_character_style_s_menu_applies_adds_renames_and_deletes`. Object › Lock › All Artwork Above and Object › Hide › All Artwork Above deselect the selected objects they lock or hide, the key object included.