diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index c51f8ef5f3..fc56340335 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1455,7 +1455,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, vision?: bool} 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); vision shows Show Color Vision Preview's row under the wheel or the box, four chips with the current color as simulated for protanopia, deuteranopia and tritanopia (the simulations of view.proofSetup's protanopia, deuteranopia and tritanopia targets) and for achromatopsia (the gray with the color's CIE L*), each named with its hex value in its tooltip and to screen readers, and taking the keyboard focus; a click or a key on a chip does not apply its color; keys left out or null keep their values ({} reads them), params that are not an object, another key or a value off the list are an error and change nothing, the settings 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, vision}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 9c9bd0f996..5403138be1 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -6186,6 +6186,11 @@ theme Appearance Външен вид The active document changed while the screen color sampler was open Активният документ се промени, докато взимането на цвят от екрана беше отворено This system has no screen color sampler Тази система няма инструмент за взимане на цвят от екрана Color blindness – Tritanopia-type Цветна слепота – тип тританопия + Show Color Vision Preview Показване на преглед на цветовото зрение + Protanopia Протанопия + Deuteranopia Девтеранопия + Tritanopia Тританопия + Achromatopsia Ахроматопсия Panels Except Tools and Control Панели без инструменти и контрол # Type › Reset Tracking and Kerning diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 05e87e6706..5256c31500 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -623,6 +623,11 @@ Color blindness – Protanopia-type Daltonizam – tip protanopije Color blindness – Deuteranopia-type Daltonizam – tip deuteranopije Color blindness – Tritanopia-type Daltonizam – tip tritanopije + Show Color Vision Preview Prikaži pregled vida boja + Protanopia Protanopija + Deuteranopia Deuteranopija + Tritanopia Tritanopija + Achromatopsia Ahromatopsija Customize… Prilagodi… Proof Colors Probne boje Zoom In Uvećaj diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index b728d60273..9d01b2a70e 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -807,6 +807,11 @@ antiAlias Sharp Nítid Color blindness – Deuteranopia-type Daltonisme – tipus deuteranòpsia Color blindness – Protanopia-type Daltonisme – tipus protanòpsia Color blindness – Tritanopia-type Daltonisme – tipus tritanòpsia + Show Color Vision Preview Mostra la previsualització de la visió del color + Protanopia Protanòpsia + Deuteranopia Deuteranòpsia + Tritanopia Tritanòpsia + Achromatopsia Acromatòpsia Color Burn Subexposa el color Color conversion: Conversió de color: Color Dodge Sobreexposició de color diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index dd0ff9056e..0aec17ea45 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -634,6 +634,11 @@ Color blindness – Protanopia-type Barvoslepost – protanopie Color blindness – Deuteranopia-type Barvoslepost – deuteranopie Color blindness – Tritanopia-type Barvoslepost – tritanopie + Show Color Vision Preview Zobrazit náhled barevného vidění + Protanopia Protanopie + Deuteranopia Deuteranopie + Tritanopia Tritanopie + Achromatopsia Achromatopsie Customize… Vlastní… Proof Colors Barvy nátisku Zoom In Zvětšit diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 2fd7df66de..6f3db0c80c 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -8771,6 +8771,11 @@ mark-style Japanese Japansk The active document changed while the screen color sampler was open Det aktive dokument ændrede sig, mens skærmfarvesampleren var åben This system has no screen color sampler Dette system har ingen skærmfarvesampler Color blindness – Tritanopia-type Farveblindhed – tritanopitype + Show Color Vision Preview Vis eksempel på farvesyn + Protanopia Protanopi + Deuteranopia Deuteranopi + Tritanopia Tritanopi + Achromatopsia Akromatopsi Panels Except Tools and Control Paneler undtagen værktøjer og kontrol Reset Tracking and Kerning Nulstil sporing og kerning Reset Horizontal Scale Nulstil vandret skalering diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index e8003d05ac..26a3c61181 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -538,6 +538,11 @@ font-technology Variable Variabel Color blindness – Deuteranopia-type Farbenblindheit – Deuteranopie Color blindness – Protanopia-type Farbenblindheit – Protanopie Color blindness – Tritanopia-type Farbenblindheit – Tritanopie + Show Color Vision Preview Farbsehvorschau einblenden + Protanopia Protanopie + Deuteranopia Deuteranopie + Tritanopia Tritanopie + Achromatopsia Achromatopsie Color Burn Farbig nachbelichten Color conversion: Farbkonvertierung: Color Dodge Farbig abwedeln diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 4cc694dfee..3875f1efe0 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -6633,6 +6633,11 @@ effect Points Σημεία Close the circular ends of open profiles. Partial sweeps also close their cut sides. Κλείσιμο των κυκλικών άκρων των ανοιχτών προφίλ. Οι μερικές περιστροφές κλείνουν επίσης τις πλευρές τομής τους. Color Panel Options Επιλογές πίνακα χρώματος Color blindness – Tritanopia-type Αχρωματοψία – τύπου τριτανοπίας + Show Color Vision Preview Εμφάνιση προεπισκόπησης χρωματικής όρασης + Protanopia Πρωτανοπία + Deuteranopia Δευτερανοπία + Tritanopia Τριτανοπία + Achromatopsia Ολική αχρωματοψία Create Dimension Δημιουργία διάστασης Darkness Σκουρότητα Destination Folder: Φάκελος προορισμού: diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index f5d5bc5909..ce28cc9653 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -558,6 +558,11 @@ font-technology Variable Variables Color blindness – Deuteranopia-type Daltonismo – tipo deuteranopía Color blindness – Protanopia-type Daltonismo – tipo protanopía Color blindness – Tritanopia-type Daltonismo – tipo tritanopía + Show Color Vision Preview Mostrar vista previa de visión del color + Protanopia Protanopía + Deuteranopia Deuteranopía + Tritanopia Tritanopía + Achromatopsia Acromatopsia Color Burn Subexponer color Color conversion: Conversión de color: Color Dodge Sobreexponer color diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 353eb09465..8b8e74eadd 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -6638,6 +6638,11 @@ mark-style Japanese Japanilainen Close the circular ends of open profiles. Partial sweeps also close their cut sides. Sulje avointen profiilien pyöreät päät. Osittaiset pyöräytykset sulkevat myös leikkauspintansa. Color Panel Options Väri-paneelin asetukset Color blindness – Tritanopia-type Värisokeus – tritanopia + Show Color Vision Preview Näytä värinäön esikatselu + Protanopia Protanopia + Deuteranopia Deuteranopia + Tritanopia Tritanopia + Achromatopsia Akromatopsia Create Dimension Luo mitta Darkness Tummuus Destination Folder: Kohdekansio: diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 35ff7b88b8..fc00e78109 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -559,6 +559,11 @@ font-technology Variable Variables Color blindness – Deuteranopia-type Daltonisme – type deutéranopie Color blindness – Protanopia-type Daltonisme – type protanopie Color blindness – Tritanopia-type Daltonisme – type tritanopie + Show Color Vision Preview Afficher un aperçu de la vision des couleurs + Protanopia Protanopie + Deuteranopia Deutéranopie + Tritanopia Tritanopie + Achromatopsia Achromatopsie Color Burn Densité couleur + Color conversion: Conversion des couleurs : Color Dodge Densité couleur - diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index a8d0b805dc..e2c6e12296 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -674,6 +674,11 @@ Color blindness – Deuteranopia-type રંગ અંધત્વ – ડ્યુટેરેનોપિયા પ્રકાર Color blindness – Protanopia-type રંગ અંધત્વ – પ્રોટેનોપિયા પ્રકાર Color blindness – Tritanopia-type રંગ અંધત્વ – ટ્રિટેનોપિયા પ્રકાર + Show Color Vision Preview રંગ દ્રષ્ટિ પૂર્વાવલોકન બતાવો + Protanopia પ્રોટેનોપિયા + Deuteranopia ડ્યુટેરેનોપિયા + Tritanopia ટ્રિટેનોપિયા + Achromatopsia એક્રોમેટોપ્સિયા Color conversion: રંગ રૂપાંતર: Color field રંગ ક્ષેત્ર Color images રંગીન ઇમેજ diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index d2519c2691..a5127a2ec1 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -936,6 +936,11 @@ antiAlias Sharp शार्प Color blindness – Deuteranopia-type कलर ब्लाइंडनेस – ड्यूटेरानोपिया प्रकार Color blindness – Protanopia-type रंग अंधापन - प्रोटानोपिया प्रकार Color blindness – Tritanopia-type कलर ब्लाइंडनेस – ट्राइटेनोपिया प्रकार + Show Color Vision Preview कलर विज़न प्रीव्यू दिखाएँ + Protanopia प्रोटानोपिया + Deuteranopia ड्यूटेरानोपिया + Tritanopia ट्राइटेनोपिया + Achromatopsia एक्रोमैटोप्सिया Color Burn कलर बर्न Color conversion: रंग रूपांतरण: Color Dodge कलर डॉज diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 7932b182f7..20580dccd0 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -737,6 +737,11 @@ font-technology Variable Változó Color blindness – Deuteranopia-type Színvakság – deuteranópia Color blindness – Protanopia-type Színvakság – protanópia Color blindness – Tritanopia-type Színvakság – tritanópia + Show Color Vision Preview Színlátás-előnézet megjelenítése + Protanopia Protanópia + Deuteranopia Deuteranópia + Tritanopia Tritanópia + Achromatopsia Akromatopszia Color Burn Színsötétítés Color conversion: Színátalakítás: Color Dodge Színvilágosítás diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index f55a0a0b44..0d998983d3 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5928,6 +5928,11 @@ mark-style Japanese Jepang The active document changed while the screen color sampler was open Dokumen aktif berubah saat pengambil warna layar terbuka This system has no screen color sampler Sistem ini tidak memiliki pengambil warna layar Color blindness – Tritanopia-type Buta warna – tipe Tritanopia + Show Color Vision Preview Tampilkan pratinjau penglihatan warna + Protanopia Protanopia + Deuteranopia Deuteranopia + Tritanopia Tritanopia + Achromatopsia Akromatopsia Panels Except Tools and Control Semua panel kecuali Alat dan Kontrol Reset Tracking and Kerning Atur ulang tracking dan kerning Reset Horizontal Scale Atur ulang skala horizontal diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 62cb0dfec8..3e68b84218 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -560,6 +560,11 @@ font-technology Variable Variabili Color blindness – Deuteranopia-type Daltonismo – tipo deuteranopia Color blindness – Protanopia-type Daltonismo – tipo protanopia Color blindness – Tritanopia-type Daltonismo – tipo tritanopia + Show Color Vision Preview Mostra anteprima della visione dei colori + Protanopia Protanopia + Deuteranopia Deuteranopia + Tritanopia Tritanopia + Achromatopsia Acromatopsia Color Burn Brucia colore Color conversion: Conversione colore: Color Dodge Scherma colore diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 0bb4c9c311..0dbdf761b1 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -682,6 +682,11 @@ digits Malayalam マラヤーラム数字 Color blindness – Protanopia-type P 型(1 型)色覚 Color blindness – Deuteranopia-type D 型(2 型)色覚 Color blindness – Tritanopia-type T 型(3 型)色覚 + Show Color Vision Preview 色覚のプレビューを表示 + Protanopia P 型色覚 + Deuteranopia D 型色覚 + Tritanopia T 型色覚 + Achromatopsia 1 色覚 Customize… カスタマイズ… Proof Colors 色の校正 Zoom In ズームイン diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 191ee5d6f8..572ddc7ef6 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -8417,6 +8417,11 @@ liquify-list-end {0}, {1} {0} და {1} @plural {n} part of the file wasn't read|{n} parts of the file weren't read ფაილის წაუკითხავი ნაწილები: {n}|ფაილის წაუკითხავი ნაწილები: {n} # Upstream sync 2026-10-16: legacy .ai export, screen color sampler, Hidden Objects, Dimension tool. Color blindness – Tritanopia-type დალტონიზმი – ტრიტანოპიის ტიპი + Show Color Vision Preview ფერთა აღქმის გადახედვის ჩვენება + Protanopia პროტანოპია + Deuteranopia დეიტერანოპია + Tritanopia ტრიტანოპია + Achromatopsia აქრომატოფსია Darkness სიმუქე Sample Color from Screen ფერის აღება ეკრანიდან This system has no screen color sampler ამ სისტემას ეკრანიდან ფერის აღების საშუალება არ აქვს diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 6277601819..d93cbef5ca 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -675,6 +675,11 @@ digits Malayalam 말라얄람어 Color blindness – Protanopia-type 색맹 – 적색맹 유형 Color blindness – Deuteranopia-type 색맹 – 녹색맹 유형 Color blindness – Tritanopia-type 색맹 – 청색맹 유형 + Show Color Vision Preview 색각 미리 보기 표시 + Protanopia 적색맹 + Deuteranopia 녹색맹 + Tritanopia 청색맹 + Achromatopsia 전색맹 Customize… 사용자 지정… Proof Colors 교정 색상 Zoom In 확대 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 511959e2b8..382fbb9521 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -8567,6 +8567,11 @@ mark-style Japanese Japans The active document changed while the screen color sampler was open Het actieve document is gewijzigd terwijl de schermkleurkiezer open was This system has no screen color sampler Dit systeem heeft geen schermkleurkiezer Color blindness – Tritanopia-type Kleurenblindheid – type tritanopie + Show Color Vision Preview Voorvertoning van kleurwaarneming tonen + Protanopia Protanopie + Deuteranopia Deuteranopie + Tritanopia Tritanopie + Achromatopsia Achromatopsie Panels Except Tools and Control Alle panelen behalve Gereedschap en Bediening Reset Tracking and Kerning Tracking en kerning herstellen Reset Horizontal Scale Horizontale schaal herstellen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index d0c56c9119..df9114ec96 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -590,6 +590,11 @@ Color blindness – Protanopia-type Daltonizm – typu protanopia Color blindness – Deuteranopia-type Daltonizm – typu deuteranopia Color blindness – Tritanopia-type Daltonizm – typu tritanopia + Show Color Vision Preview Pokaż podgląd widzenia barw + Protanopia Protanopia + Deuteranopia Deuteranopia + Tritanopia Tritanopia + Achromatopsia Achromatopsja Customize… Dostosuj… Proof Colors Próba kolorów Zoom In Powiększ diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 245737c339..b6825f7436 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -548,6 +548,11 @@ antiAlias Sharp Nítido Color blindness – Deuteranopia-type Daltonismo – tipo deuteranopia Color blindness – Protanopia-type Daltonismo – tipo protanopia Color blindness – Tritanopia-type Daltonismo – tipo tritanopia + Show Color Vision Preview Mostrar Visualização da Visão de Cores + Protanopia Protanopia + Deuteranopia Deuteranopia + Tritanopia Tritanopia + Achromatopsia Acromatopsia Color conversion: Conversão de cor: Color images Imagens coloridas Color: Cor: diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 9ff8228f18..b32bb6e6e1 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -556,6 +556,11 @@ font-technology Variable Вариативные Color blindness – Deuteranopia-type Дальтонизм — дейтеранопия Color blindness – Protanopia-type Дальтонизм — протанопия Color blindness – Tritanopia-type Дальтонизм — тританопия + Show Color Vision Preview Показать имитацию цветового зрения + Protanopia Протанопия + Deuteranopia Дейтеранопия + Tritanopia Тританопия + Achromatopsia Ахроматопсия Color Burn Затемнение основы Color conversion: Преобразование цвета: Color Dodge Осветление основы diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 42560b0efa..1d12f301be 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -6623,6 +6623,11 @@ theme Appearance Utseende Close the circular ends of open profiles. Partial sweeps also close their cut sides. Stäng de cirkulära ändarna på öppna profiler. Partiella svep stänger även sina snittsidor. Color Panel Options Alternativ för panelen Färg Color blindness – Tritanopia-type Färgblindhet – tritanopi + Show Color Vision Preview Visa förhandsvisning av färgseende + Protanopia Protanopi + Deuteranopia Deuteranopi + Tritanopia Tritanopi + Achromatopsia Akromatopsi Create Dimension Skapa mått Darkness Mörkhet Destination Folder: Målmapp: diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 4c4c61738a..bb011f5c00 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -540,6 +540,11 @@ font-technology Variable Değişken Color blindness – Deuteranopia-type Renk körlüğü – Döteranopi tipi Color blindness – Protanopia-type Renk körlüğü – Protanopi tipi Color blindness – Tritanopia-type Renk körlüğü – Tritanopia tipi + Show Color Vision Preview Renk Görme Önizlemesini Göster + Protanopia Protanopi + Deuteranopia Döteranopi + Tritanopia Tritanopi + Achromatopsia Akromatopsi Color Burn Renkli Yanık Color conversion: Renk dönüşümü: Color Dodge Renk Soldurma diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 0bb6f933de..2a63175b20 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -554,6 +554,11 @@ font-technology Variable Варіативні Color blindness – Deuteranopia-type Дальтонізм - дейтеранопія Color blindness – Protanopia-type Дальтонізм - протанопія Color blindness – Tritanopia-type Дальтонізм - тританопія + Show Color Vision Preview Показати імітацію колірного зору + Protanopia Протанопія + Deuteranopia Дейтеранопія + Tritanopia Тританопія + Achromatopsia Ахроматопсія Color Burn Затемнення основи Color conversion: Перетворення кольору: Color Dodge Освітлення основи diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 9bdb43c54c..dc1385658c 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -651,6 +651,11 @@ font-technology Variable Biến thiên Color blindness – Deuteranopia-type Mù màu – loại Deuteranopia Color blindness – Protanopia-type Mù màu – loại Protanopia Color blindness – Tritanopia-type Mù màu – loại Tritanopia + Show Color Vision Preview Hiện xem trước thị giác màu + Protanopia Mù màu đỏ + Deuteranopia Mù màu lục + Tritanopia Mù màu lam + Achromatopsia Mù màu toàn phần Color Burn Đốt màu Color conversion: Chuyển đổi màu: Color Dodge Tránh màu diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 52e22456e1..b50e0c1d89 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -505,6 +505,11 @@ antiAlias Sharp 锐利 Color blindness – Deuteranopia-type 色盲 – 绿色盲型 Color blindness – Protanopia-type 色盲 – 红色盲型 Color blindness – Tritanopia-type 色盲 – 蓝色盲型 + Show Color Vision Preview 显示色觉预览 + Protanopia 红色盲 + Deuteranopia 绿色盲 + Tritanopia 蓝色盲 + Achromatopsia 全色盲 Color Burn 颜色加深 Color conversion: 色彩转换: Color Dodge 颜色减淡 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 47d4298086..76ce3360b1 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -522,6 +522,11 @@ font-technology Variable 可變 Color blindness – Deuteranopia-type 色盲 – 綠色盲型 Color blindness – Protanopia-type 色盲 – 紅色盲型 Color blindness – Tritanopia-type 色盲 – 藍色盲型 + Show Color Vision Preview 顯示色覺預覽 + Protanopia 紅色盲 + Deuteranopia 綠色盲 + Tritanopia 藍色盲 + Achromatopsia 全色盲 Color Burn 加深顏色 Color conversion: 色彩轉換: Color Dodge 加亮顏色 diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 3c342b704e..71640e08ac 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1456,7 +1456,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, vision?: bool} 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); vision shows Show Color Vision Preview's row under the wheel or the box, four chips with the current color as simulated for protanopia, deuteranopia and tritanopia (the simulations of view.proofSetup's protanopia, deuteranopia and tritanopia targets) and for achromatopsia (the gray with the color's CIE L*), each named with its hex value in its tooltip and to screen readers, and taking the keyboard focus; a click or a key on a chip does not apply its color; keys left out or null keep their values ({} reads them), params that are not an object, another key or a value off the list are an error and change nothing, the settings 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, vision}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 9734f76867..f0005662c7 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -810,6 +810,8 @@ mod tests_color_wheel; #[cfg(test)] mod tests_color_wheel_box; #[cfg(test)] +mod tests_color_wheel_vision; +#[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..bbc2b588c5 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -10,12 +10,20 @@ //! The panel menu's Box View puts a box in the wheel's place: a color field with a vertical //! channel strip at its right, for the channel picked under Box Channel (Hue, Saturation, //! Brightness, Red, Green or Blue). The field shows the other two components on the Color -//! Picker's axes. The view and the channel are kept with the preferences (`ui.colorWheel`). +//! Picker's axes. +//! +//! Panel menu › Show Color Vision Preview adds a row under the wheel or the box with the color as +//! simulated for protanopia, deuteranopia and tritanopia, through the simulations View › Proof +//! Setup uses, and for achromatopsia as the gray with the color's CIE L*. The chips only show the +//! simulation. +//! +//! The view, the channel and Show Color Vision Preview are kept with the preferences +//! (`ui.colorWheel`). -use egui::{Ui, UiBuilder, vec2}; +use egui::{Rect, Sense, Stroke, StrokeKind, Ui, UiBuilder, vec2}; use serde::{Deserialize, Serialize}; use serde_json::{Value, json}; -use vectorcraft_color::cms::{self, Cms}; +use vectorcraft_color::cms::{self, Cms, ProofSetup, ProofTarget}; use vectorcraft_color::{Color, Paint, hsb_to_rgb, rgb_to_hsb}; use vectorcraft_doc::{ColorMode, NodeId}; @@ -23,6 +31,7 @@ use super::color::{Target, apply, wheel_target}; use super::{pstate, set_pstate}; use crate::VectorcraftApp; use crate::dialogs::color_picker::Channel; +use crate::theme::Tokens; use crate::widgets::{self, FieldAxis, Live, SliderValue, menu_item}; pub const ID: &str = "colorWheel"; @@ -67,6 +76,10 @@ pub struct Settings { pub view: View, #[serde(serialize_with = "serialize_channel", deserialize_with = "deserialize_channel")] pub channel: Channel, + /// Show Color Vision Preview: the row of simulated colors under the wheel or the box. A saved + /// `true` shows the row and any other value hides it. + #[serde(deserialize_with = "crate::panels::color::deserialize_rgb_percent")] + pub vision: bool, } fn deserialize_view<'de, D: serde::Deserializer<'de>>(d: D) -> Result { @@ -90,11 +103,12 @@ pub fn deserialize_settings<'de, D: serde::Deserializer<'de>>(d: D) -> Result Result { - const KEYS: [&str; 2] = ["view", "channel"]; + const KEYS: [&str; 3] = ["view", "channel", "vision"]; match p { Value::Null => {} Value::Object(o) => { @@ -113,11 +127,15 @@ 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")?, } + if let Some(on) = crate::menus::opt_bool(p, "vision")? { + set.vision = on; + } 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, Box Channel while the box shows, and Show Color Vision +/// Preview. 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 +152,10 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { } }); }); + ui.separator(); + if menu_item(ui, tl!("Show Color Vision Preview"), true, set.vision) { + command(app, &json!({ "vision": !set.vision })).ok(); + } } /// The display values of HSB `hsb` in `ch`'s space, from 0 to 1: hue, saturation and brightness, @@ -207,6 +229,65 @@ fn show_box(ui: &mut Ui, ch: Channel, hsb: [f32; 3], marked: bool, size: f32) -> /// Panel state: the HSB picked last, its [`Owner`] and the display sRGB of the color it stored. const MEMORY: &str = "color-wheel-hsb"; +/// The height of the color vision chips and the space between them. +const VISION_CHIP: f32 = 16.0; +const VISION_GAP: f32 = 3.0; + +/// The display sRGB of `c` as simulated for protanopia, deuteranopia and tritanopia, through +/// `cms`'s Proof Setup simulations, and for achromatopsia: the gray with `c`'s CIE L*, through the +/// same display transform. +pub(crate) fn vision_colors(cms: &Cms, c: &Color) -> [[f32; 3]; 4] { + let srgb = cms.display_rgb(c); + let proof = |target| cms.proof_srgb(srgb, &ProofSetup { target, ..Default::default() }); + let gray = cms.display_rgb(&Color::lab(cms.lab(c).l, 0.0, 0.0)); + [proof(ProofTarget::Protanopia), proof(ProofTarget::Deuteranopia), proof(ProofTarget::Tritanopia), gray] +} + +/// The names of the color vision chips, in the order of [`vision_colors`]. +fn vision_names() -> [String; 4] { + [tl!("Protanopia"), tl!("Deuteranopia"), tl!("Tritanopia"), tl!("Achromatopsia")].map(|s| s.to_string()) +} + +/// The 0 to 255 values of display sRGB `rgb`. +pub(crate) fn bytes(rgb: [f32; 3]) -> [u8; 3] { + rgb.map(|v| (v.clamp(0.0, 1.0) * 255.0).round() as u8) +} + +/// The hex text of 0 to 255 values, in the form of the Color panel's hex field (`E67828`). +pub(crate) fn hex([r, g, b]: [u8; 3]) -> String { + format!("{r:02X}{g:02X}{b:02X}") +} + +/// The Show Color Vision Preview row: four chips across the panel with `color` as each color +/// vision deficiency shows it. Each chip takes the keyboard focus and reports its name and, with a +/// solid color, its hex value as its value to screen readers; its tooltip shows both. A click or a +/// key on a chip does nothing. With no solid color the chips are empty and keep their names in the tooltip and for screen +/// readers. +fn vision_row(ui: &mut Ui, cms: &Cms, color: Option<&Color>) { + let t = Tokens::get(ui.ctx()); + let colors = color.map(|c| vision_colors(cms, c)); + let width = ui.available_width(); + let (row, _) = ui.allocate_exact_size(vec2(width, VISION_CHIP), Sense::hover()); + let w = ((width - 3.0 * VISION_GAP) / 4.0).max(1.0); + let enabled = ui.is_enabled(); + for (i, name) in vision_names().into_iter().enumerate() { + let cell = Rect::from_min_size(row.min + vec2(i as f32 * (w + VISION_GAP), 0.0), vec2(w, VISION_CHIP)); + let resp = ui.interact(cell, ui.scope_id().with(("color-vision", i)), Sense::focusable_noninteractive()); + let value = colors.map(|cs| { + let [r, g, b] = bytes(cs[i]); + ui.painter().rect_filled(cell, 0.0, egui::Color32::from_rgb(r, g, b)); + hex([r, g, b]) + }); + let stroke = if resp.has_focus() { ui.visuals().selection.stroke } else { Stroke::new(1.0, t.border) }; + ui.painter().rect_stroke(cell, 0.0, stroke, StrokeKind::Inside); + let tip = match &value { + Some(v) => format!("{name}\n{v}"), + None => name.clone(), + }; + resp.widget_info(|| egui::WidgetInfo { current_text_value: value.clone(), ..egui::WidgetInfo::labeled(egui::Role::Image, enabled, &name) }); + resp.on_hover_text(tip); + } +} /// What the HSB picked last belongs to: the document, the selected objects or text characters, /// the appearance item, the proxy, the gradient stop or freeform point, its paint, and the color @@ -344,6 +425,10 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { pick = Some(([hsb[0], x, 1.0 - y], field_phase)); } }); + if app.ui.color_wheel.vision { + ui.add_space(4.0); + vision_row(ui, &cms, color.as_ref()); + } let Some((hsb, phase)) = pick else { return }; let behind = super::alt_held(ui); let cmyk_doc = app.session.active().is_some_and(|d| d.doc.color_mode == ColorMode::Cmyk); 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 0b59a44d98..d527bf1fa8 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,16 @@ 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"})); + assert_eq!(app.run("ui.colorWheel", json!({})).unwrap(), json!({"view": "wheel", "channel": "hue", "vision": false})); + assert_eq!(app.run("ui.colorWheel", json!({"view": "box"})).unwrap(), json!({"view": "box", "channel": "hue", "vision": false})); + assert_eq!(app.run("ui.colorWheel", json!({"channel": "green"})).unwrap(), json!({"view": "box", "channel": "green", "vision": false})); 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, vision: false }, "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"], json!({"view": "box", "channel": "green", "vision": false})); } /// The command's errors are translated in the catalogs that translate status and error messages, @@ -211,10 +211,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, vision"); 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, vision"); + assert_eq!(app.ui.color_wheel, Settings { view: View::Box, channel: Channel::Red, vision: false }, "an error changes nothing"); } /// With None there is no color to edit: the strip reads 0 to screen readers, as the hue ring does, @@ -270,7 +270,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, vision: true }, + 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); @@ -283,11 +287,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(), vision: false }); 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, vision: false }); 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_vision.rs b/crates/ui-egui/src/panels/tests_color_wheel_vision.rs new file mode 100644 index 0000000000..5c73496642 --- /dev/null +++ b/crates/ui-egui/src/panels/tests_color_wheel_vision.rs @@ -0,0 +1,271 @@ +//! The Color Wheel panel's Show Color Vision Preview row drawn headless: the simulated colors, their +//! names and values, the painted chips, a gray fill, no solid color, clicks and keys on the chips, +//! the keyboard focus, the panel menu and `ui.colorWheel`. + +use egui::{Color32, Key, Modifiers, Rect, Shape, vec2}; +use egui_kittest::Harness; +use egui_kittest::kittest::{NodeT, Queryable}; +use serde_json::{Value, json}; +use vectorcraft_color::Color; +use vectorcraft_color::cms::{self, ProofSetup, ProofTarget}; +use vectorcraft_engine::Session; + +use super::color_wheel::{bytes, show, vision_colors}; +use crate::VectorcraftApp; + +/// `#rrggbb` of display sRGB `rgb`, as the chips show it. +fn hex(rgb: [f32; 3]) -> String { + super::color_wheel::hex(bytes(rgb)) +} + +const NAMES: [&str; 4] = ["Protanopia", "Deuteranopia", "Tritanopia", "Achromatopsia"]; + +/// A document with a selected rectangle filled with `fill`, with Show Color Vision Preview on. +fn app(fill: Value) -> 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!({"vision": true})).unwrap(); + app +} + +fn harness(app: VectorcraftApp) -> Harness<'static, VectorcraftApp> { + let mut h = Harness::builder().with_size(vec2(260.0, 360.0)).build_ui_state(|ui, app: &mut VectorcraftApp| show(app, ui), app); + h.run_steps(2); + h +} + +/// The value a chip reports to screen readers. +fn value(h: &Harness<'static, VectorcraftApp>, name: &str) -> Option { + h.get_by_label(name).value() +} + +fn fill(app: &VectorcraftApp) -> Color { + super::current_paints(app).0.color().expect("a solid fill") +} + +fn undo_len(app: &VectorcraftApp) -> usize { + app.session.doc().unwrap().history.undo.len() +} + +/// The fill painted inside `cell`, if a filled rectangle covers it. +fn painted(h: &Harness<'static, VectorcraftApp>, cell: Rect) -> Option { + h.output().shapes.iter().find_map(|c| match &c.shape { + Shape::Rect(r) + if r.fill != Color32::TRANSPARENT && r.rect.expand(0.5).contains_rect(cell.shrink(0.5)) && cell.expand(0.5).contains_rect(r.rect) => + { + Some(r.fill) + } + _ => None, + }) +} + +fn color32(hex: &str) -> Color32 { + Color32::from_hex(&format!("#{hex}")).expect("an RRGGBB value") +} + +/// The protanopia, deuteranopia and tritanopia chips show the fill as View › Proof Setup's +/// simulations show it: each reports the simulation's hex value and is painted in it. +#[test] +fn the_chips_show_the_proof_setup_simulations_of_the_fill() { + let h = harness(app(json!("#3366cc"))); + let cms = cms::active(); + let srgb = cms.display_rgb(&fill(h.state())); + for (name, target) in + [("Protanopia", ProofTarget::Protanopia), ("Deuteranopia", ProofTarget::Deuteranopia), ("Tritanopia", ProofTarget::Tritanopia)] + { + let want = hex(cms.proof_srgb(srgb, &ProofSetup { target, ..Default::default() })); + assert_eq!(value(&h, name).as_deref(), Some(want.as_str()), "{name}"); + assert_eq!(painted(&h, h.get_by_label(name).rect()), Some(color32(&want)), "{name} is painted {want}"); + } +} + +/// The achromatopsia chip of a red fill is the gray with red's CIE L* (D50, about 54.29: 828282), +/// and the simulations of a pure red differ from it and from each other. +#[test] +fn the_achromatopsia_chip_is_the_gray_of_the_colors_lightness() { + let cms = cms::active(); + let [p, d, t, a] = vision_colors(&cms, &Color::rgb(1.0, 0.0, 0.0)); + assert_eq!(hex(a), "828282"); + assert_ne!(hex(p), hex(d)); + assert_ne!(hex(t), hex(a)); + let h = harness(app(json!("#ff0000"))); + assert_eq!(value(&h, "Achromatopsia").as_deref(), Some("828282")); + assert_eq!(painted(&h, h.get_by_label("Achromatopsia").rect()), Some(color32("828282"))); +} + +/// A gray fill shows as the same gray in every chip. +#[test] +fn a_gray_fill_is_the_same_gray_in_every_chip() { + let h = harness(app(json!("#808080"))); + let gray = hex(cms::active().display_rgb(&fill(h.state()))); + for name in NAMES { + assert_eq!(value(&h, name).as_deref(), Some(gray.as_str()), "{name} shows {gray}"); + } +} + +/// With the box in the wheel's place the row shows under the box, with the same values. +#[test] +fn the_row_shows_under_the_box_too() { + let mut a = app(json!("#3366cc")); + a.run("ui.colorWheel", json!({"view": "box", "channel": "red"})).unwrap(); + let h = harness(a); + let [p, ..] = vision_colors(&cms::active(), &fill(h.state())); + assert_eq!(value(&h, "Protanopia").as_deref(), Some(hex(p).as_str())); + let field = h.get_by_label("Color box").rect(); + for name in NAMES { + assert!(h.get_by_label(name).rect().top() >= field.bottom(), "{name} is under the box"); + } +} + +/// With a None fill the chips carry only their names, with no value and no color. +#[test] +fn with_a_none_fill_the_chips_have_no_color() { + let mut a = app(json!("#ff0000")); + a.run("paint.setFill", json!({"none": true})).unwrap(); + let h = harness(a); + for name in NAMES { + assert_eq!(value(&h, name), None, "{name} has no value"); + assert_eq!(painted(&h, h.get_by_label(name).rect()), None, "{name} is not painted"); + } +} + +/// Screen readers find each chip by its deficiency name, with its hex value as its value, and Tab +/// steps through the four chips in order. +#[test] +fn the_chips_take_the_focus_and_report_their_names_and_values() { + let mut h = harness(app(json!("#3366cc"))); + for name in NAMES { + let node = h.get_by_label(name); + assert_eq!(node.accesskit_node().role(), egui::accesskit::Role::Image, "{name}"); + assert!( + node.value().is_some_and(|v| v.len() == 6 && v.bytes().all(|b| b.is_ascii_digit() || b.is_ascii_uppercase())), + "{name}: {:?}", + node.value() + ); + assert!(!node.accesskit_node().is_disabled(), "{name}"); + } + tab_to(&mut h, NAMES[0]); + for name in &NAMES[1..] { + h.key_press(Key::Tab); + h.run_steps(1); + assert!(h.get_by_label(name).accesskit_node().is_focused(), "the next Tab reaches {name}"); + } +} + +/// Press Tab until the chip `name` has the keyboard focus. Tab stops on the panel's other controls +/// first. +fn tab_to(h: &mut Harness<'static, VectorcraftApp>, name: &str) { + for _ in 0..40 { + if h.get_by_label(name).accesskit_node().is_focused() { + break; + } + h.key_press(Key::Tab); + h.run_steps(1); + } + assert!(h.get_by_label(name).accesskit_node().is_focused(), "Tab reaches {name}"); +} + +/// A click on a chip, and Enter or Space on a focused chip, leave the fill and the undo history as +/// they were. +#[test] +fn a_click_or_a_key_on_a_chip_applies_nothing() { + let mut h = harness(app(json!("#3366cc"))); + let (before, undo) = (fill(h.state()), undo_len(h.state())); + for name in NAMES { + h.get_by_label(name).click(); + h.run_steps(2); + tab_to(&mut h, name); + for key in [Key::Enter, Key::Space] { + h.key_press_modifiers(Modifiers::NONE, key); + h.run_steps(1); + } + assert_eq!(fill(h.state()), before, "{name}"); + assert_eq!(undo_len(h.state()), undo, "{name}: no undo step"); + } +} + +/// Without the setting the row is not drawn, and the panel menu's Show Color Vision Preview turns +/// it on and off. +#[test] +fn the_panel_menu_turns_the_row_on_and_off() { + let mut a = app(json!("#3366cc")); + a.run("ui.colorWheel", json!({"vision": false})).unwrap(); + let h = harness(a); + assert!(h.query_by_label_contains("Protanopia").is_none()); + let mut a = app(json!("#3366cc")); + a.run("ui.colorWheel", json!({"vision": false})).unwrap(); + let mut fonts = false; + let mut menu = Harness::builder().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; + } + super::color_wheel::menu(app, ui); + }, + a, + ); + menu.run_steps(3); + menu.get_by_label_contains("Show Color Vision Preview").click(); + menu.run_steps(2); + assert!(menu.state().ui.color_wheel.vision); + menu.get_by_label_contains("Show Color Vision Preview").click(); + menu.run_steps(2); + assert!(!menu.state().ui.color_wheel.vision); +} + +/// `ui.colorWheel` sets the keys given and reads them with `{}`, and `ui.inspect` reports them as +/// `ui.color_wheel`. A `vision` value other than true, false or null, params that are not an object +/// and another key are errors that change nothing, the view and the channel given with them +/// included. +#[test] +fn ui_color_wheel_sets_and_reads_the_settings() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + assert_eq!(app.run("ui.colorWheel", json!({})).unwrap(), json!({"view": "wheel", "channel": "hue", "vision": false})); + assert_eq!(app.run("ui.colorWheel", json!({"vision": true})).unwrap(), json!({"view": "wheel", "channel": "hue", "vision": true})); + assert_eq!(crate::control::inspect(&app, &egui::Context::default())["ui"]["color_wheel"]["vision"], true); + assert_eq!(app.run("ui.colorWheel", json!({"vision": "no"})).unwrap_err(), "`vision` must be true or false"); + assert_eq!(app.run("ui.colorWheel", json!({"view": "box", "channel": "red", "vision": 1})).unwrap_err(), "`vision` must be true or false"); + assert_eq!(app.run("ui.colorWheel", json!({})).unwrap(), json!({"view": "wheel", "channel": "hue", "vision": true})); + assert_eq!(app.run("ui.colorWheel", json!("junk")).unwrap_err(), "the params must be an object, not \"junk\""); + assert_eq!(app.run("ui.colorWheel", json!(5)).unwrap_err(), "the params must be an object, not 5"); + assert_eq!( + app.run("ui.colorWheel", json!({"visoin": false})).unwrap_err(), + "unknown parameter `visoin`; the command takes: view, channel, vision" + ); + assert!(app.ui.color_wheel.vision); + assert_eq!(app.run("ui.colorWheel", json!({"vision": null})).unwrap()["vision"], true); + assert_eq!(app.run("ui.colorWheel", Value::Null).unwrap()["vision"], true); + // Setting the view or the channel keeps the row, and setting the row keeps them. + assert_eq!(app.run("ui.colorWheel", json!({"view": "box"})).unwrap()["vision"], true); + assert_eq!(app.run("ui.colorWheel", json!({"vision": false})).unwrap(), json!({"view": "box", "channel": "hue", "vision": false})); +} + +/// `ui.colorWheel` answers every junk parameter, with and without a document, without a panic. +#[test] +fn ui_color_wheel_answers_junk_params_without_a_panic() { + let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == "ui.colorWheel").expect("registered").3; + let mut app = app(json!("#3366cc")); + let mut empty = VectorcraftApp::new(Session::new(), Default::default()); + for p in vectorcraft_testkit::strategies::junk_params(doc, "/nonexistent").into_iter().chain(vectorcraft_testkit::strategies::junk_values()) { + let _ = app.run("ui.colorWheel", p.clone()); + let _ = empty.run("ui.colorWheel", p); + } +} + +/// The saved settings read leniently: a value this build does not know reads as the default and +/// the other preferences are kept. +#[test] +fn saved_settings_read_leniently() { + let read = |v: Value| serde_json::from_value::(v).expect("the preferences read"); + let s = read(json!({"color_wheel": {"vision": true}, "color_rgb_percent": true})); + assert!(s.color_wheel.vision && s.color_rgb_percent); + let s = read(json!({"color_wheel": {"vision": "yes", "later": 3}, "color_rgb_percent": true})); + assert!(!s.color_wheel.vision && s.color_rgb_percent); + let s = read(json!({"color_wheel": "junk", "color_rgb_percent": true})); + assert!(!s.color_wheel.vision && s.color_rgb_percent); +} diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 79b35e9392..d9f0bc6366 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -772,8 +772,8 @@ pub struct UiState { /// of an RGB field, `ui.colorPanel`, [`crate::panels::color::deserialize_rgb_percent`]). #[serde(default, deserialize_with = "crate::panels::color::deserialize_rgb_percent")] pub color_rgb_percent: bool, - /// Color Wheel panel: the wheel or the box, and the box's channel (`ui.colorWheel`, - /// [`crate::panels::color_wheel::deserialize_settings`]). + /// Color Wheel panel: the wheel or the box, the box's channel, and the color vision row + /// (`ui.colorWheel`, [`crate::panels::color_wheel::deserialize_settings`]). #[serde(default, deserialize_with = "crate::panels::color_wheel::deserialize_settings")] pub color_wheel: crate::panels::color_wheel::Settings, /// Swatches panel: Show Recent Colors in its panel menu, which draws the panel's Recent Colors diff --git a/docs/control-protocol.md b/docs/control-protocol.md index e3d6636c3e..f8c8e55a52 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -268,9 +268,9 @@ My Themes tab lists the saved themes; every action runs a command (`colorTheme.s Color Wheel panel (`window.panel {panel: "colorWheel"}`): a hue ring around a saturation and brightness square. A pick runs the commands the Color panel's sliders run: `paint.setFill` or `paint.setStroke` with `keepModel`, `paint.editGradient` for a gradient's selected stop, and `paint.freeform.setPoint` for a freeform gradient's selected -point (the first stop or point when none is selected). `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?, vision?}` shows the wheel or +the box (a color field with a channel strip at its right), picks the box's channel and shows or hides the color vision +row; it returns the settings, and `ui.inspect` reports them as `ui.color_wheel`. Edit Colors dialogs: `ui.colorBalanceDialog` opens Adjust Colors (`colorBalance`: fields `mode` `gray`/`rgb`/`cmyk`/ `global`, the channels `r` `g` `b` / `c` `m` `y` `k` / `gray` / `tint` (global mode) from −100 to 100, `convert`, `fill`, `stroke`, diff --git a/docs/mcp.md b/docs/mcp.md index 7dae1fe42d..ed5e6bacf5 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -683,8 +683,13 @@ 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. +the list return an error and change nothing. The command returns `{view, channel, vision}`, and the settings are +kept with the preferences. +`ui.colorWheel {"vision": true}` turns on the Color Wheel panel's Show Color Vision Preview, as its panel menu +does: a row of four chips under the wheel or the box shows the current color through the protanopia, deuteranopia +and tritanopia simulations of `view.proofSetup`, and for achromatopsia as the gray with the color's CIE L*. Each +chip reports its name and hex value to screen readers, and a click on a chip does not apply its color. `false` +hides the row, and `null` keeps the setting. Any other value returns an error and changes nothing. 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 06e8d1aabf..3d6ce68e58 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1858,6 +1858,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur The Color panel spectrum grows into the vertical space of a resized panel, with Show Options or Hide Options (#8005); compact auto-fit flyouts and embedded mixers retain their previous height. Regression: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. A double-click right of an RGB field switches the Color panel's R, G and B between percent and 0 to 255 ([Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), Color panel). In VectorCraft the color does not change, Web Safe RGB and the hex field stay in 0 to 255, and the panel keeps the choice between sessions (`ui.colorPanel {rgbPercent}`); the color mixer of the Fill and Stroke chips and the gradient stop dialog follow the same setting. Toggle RGB Percent (`ui.colorRgbPercent`) in the command palette and Keyboard Shortcuts switches the units from the keyboard. Tests: `rgb_percent_switches_the_rgb_fields_between_percent_and_0_to_255`, `rgb_percent_does_not_switch_while_the_rows_are_disabled`, `rgb_percent_comes_back_after_a_restart` and `toggle_rgb_percent_switches_the_units_from_the_keyboard` in `crates/ui-egui/src/panels/color/tests.rs`. View › Proof Setup › Color blindness – Tritanopia-type turns Proof Colors on and proofs the canvas with the tritanopia simulation of Brettel, Viénot and Mollon (1997). The Separations Preview panel's Proof Setup list offers the same target (`view.proofSetup {target: "tritanopia"}`). Grays keep their value. + In VectorCraft the Color Wheel panel menu's Show Color Vision Preview (`ui.colorWheel {vision: true}`) adds a row of four chips under the wheel or the box: the current color through the protanopia, deuteranopia and tritanopia simulations that View › Proof Setup uses, and an achromatopsia chip, which is VectorCraft's own gray with the color's CIE L*. Each chip takes the keyboard focus and gives its name and hex value in its tooltip and to screen readers, and a click on one does not apply it. The setting is kept with the preferences. Tests: `crates/ui-egui/src/panels/tests_color_wheel_vision.rs`. The Separations Preview panel's Gamut Check button reports one color outside the CMYK gamut in the singular and more in the plural, in English and in each language's plural forms (`gamut_check_status_takes_the_plural_form` in `crates/ui-egui/src/i18n/tests.rs`). The "?" on the Fill and Stroke proxies finds a few selected objects along their cached places in the document instead of walking every object; a large selection takes one walk, as before. The proxies show the same paints and question marks as before, also for an id that a damaged file repeats. On a document of 50,000 rectangles in 500 groups on 5 layers with one object selected, the check takes under 5 µs of CPU time instead of a median of 995 µs in a release build on Linux, so the gain shows on large documents (seven alternating runs, `cargo test --release -p vectorcraft-engine --lib proxy_mixed_timing -- --ignored --nocapture`). - **Document Color Mode outside the layers:** File › Document Color Mode (in one undo step) and `document.open {colorMode}` also convert the colors of graph designs, graphic styles, opacity-mask art, the tile that pattern editing's Cancel puts back and the art of brushes (with a Hue Shift brush's key color); a tint of a global swatch there becomes the converted swatch's color at its tint, as in the art.