From 804f844fcf6ea139df32c39e90f4695b8d59dc1a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 07:24:54 -0800 Subject: [PATCH 1/5] Part of #978: the Color Wheel panel can gray out colors the CMYK space cannot print The panel menu gains Show Out-of-Gamut Colors. While it is on, the wheel's square and the box's color field draw gray over the cells of a 16 by 16 grid whose colors fail the out-of-gamut warning's test (`Cms::out_of_gamut` on the color a pick there would store). The grid is kept in panel state per channel, strip value, color settings and loaded profiles, so it is computed again only when one of them changes, including when a profile is loaded again under the same name. `ui.colorWheel {gamut?}` sets it, and the setting is kept with the preferences. --- crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/i18n/bg.tsv | 1 + crates/ui-egui/src/i18n/bs.tsv | 1 + crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/gu.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/id.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/panels.rs | 2 + crates/ui-egui/src/panels/color_wheel.rs | 115 +++++++++- .../src/panels/tests_color_wheel_box.rs | 23 +- .../src/panels/tests_color_wheel_gamut.rs | 216 ++++++++++++++++++ crates/ui-egui/src/state.rs | 2 +- crates/ui-egui/src/widgets.rs | 6 +- crates/ui-egui/src/widgets/color.rs | 67 +++++- docs/control-protocol.md | 6 +- docs/mcp.md | 8 +- docs/target-app-parity.md | 2 +- 40 files changed, 443 insertions(+), 36 deletions(-) create mode 100644 crates/ui-egui/src/panels/tests_color_wheel_gamut.rs diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 943faa4782..b75851677b 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, gamut?: 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); gamut true grays out the parts of the wheel's square and the box's field whose colors the CMYK space cannot print (the out-of-gamut warning's test, as color.gamutCheck answers it), as Show Out-of-Gamut Colors does, and false shows them again; 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 three 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, gamut}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 348ac7b881..c3c5c14d79 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -2373,6 +2373,7 @@ font-technology Variable Променливи The Scripts folder cannot be read Папката Scripts не може да бъде прочетена Other Script… Друг скрипт… Out of Gamut Warning Предупреждение за излизане извън цветовата гама + Show Out-of-Gamut Colors Показване на цветовете извън цветовата гама Out of Web Color Warning Предупреждение за цвят извън уеб палитрата Out Tangent Handles Външни тангентни дръжки Outer Glow… Външно разсейване… diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 3b1a9e001c..f63d89b0ad 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -1649,6 +1649,7 @@ digits Malayalam Malajalam Create New Swatch… Kreiraj novi uzorak boje… Name 40% Naziv 40% Out of Gamut Warning Upozorenje o izlasku iz gamuta + Show Out-of-Gamut Colors Prikaži boje izvan gamuta Out of Web Color Warning Upozorenje o boji izvan weba Web Safe RGB Sigurni web RGB {warning}: click to correct to the closest color ({hex}) {warning}: kliknite za ispravku na najbližu boju ({hex}) diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 488b46c4f5..d0f028a97b 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -3010,6 +3010,7 @@ digits Malayalam Malaiàlam Other Library… Una altra biblioteca… Other Script… Un altre script… Out of Gamut Warning Avís fora de gama + Show Out-of-Gamut Colors Mostra els colors fora de gama Out of Web Color Warning Avís fora dels colors web Out Tangent Handles Nanses tangents de sortida Outer Corner Tile Mosaic de cantonada exterior diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 6a57e90e37..7ee7411790 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -1678,6 +1678,7 @@ digits Malayalam Malajálamské Create New Swatch… Vytvořit novou položku vzorníku… Name 40% Název 40 % Out of Gamut Warning Upozornění na barvu mimo gamut + Show Out-of-Gamut Colors Zobrazit barvy mimo gamut Out of Web Color Warning Upozornění na barvu mimo webovou paletu Web Safe RGB Webově bezpečné RGB {warning}: click to correct to the closest color ({hex}) {warning}: kliknutím opravíte na nejbližší barvu ({hex}) diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 54a79e38e5..bc38e95000 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -1584,6 +1584,7 @@ digits Malayalam Malayalam Create New Swatch… Opret ny farveprøve… Name 40% Navn 40% Out of Gamut Warning Advarsel: uden for gamut + Show Out-of-Gamut Colors Vis farver uden for gamut Out of Web Color Warning Advarsel: ikke-websikker farve Web Safe RGB Websikker RGB {warning}: click to correct to the closest color ({hex}) {warning}: klik for at rette til den nærmeste farve ({hex}) diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index ab77cb0dd7..6802775e29 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -2411,6 +2411,7 @@ file-filter Templates Vorlagen Other Library… Andere Bibliothek… Other Script… Anderes Skript… Out of Gamut Warning Warnung: außerhalb des Farbumfangs + Show Out-of-Gamut Colors Farben außerhalb des Farbumfangs einblenden Out of Web Color Warning Warnung: keine Webfarbe Out Tangent Handles Ausgehende Tangentengriffe Outer Glow… Schein nach außen… diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index a1a203a257..9a9b9bcbef 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -3273,6 +3273,7 @@ theme Appearance Εμφάνιση Other Library… Άλλη βιβλιοθήκη… Other Script… Άλλο σενάριο… Out of Gamut Warning Προειδοποίηση εκτός χρωματικής γκάμας + Show Out-of-Gamut Colors Εμφάνιση χρωμάτων εκτός χρωματικής γκάμας Out of Web Color Warning Προειδοποίηση εκτός χρωμάτων ιστού Out Tangent Handles Λαβές εξερχόμενης εφαπτομένης Outline Others Περιγράμματα άλλων diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 45fd0d8235..2580f20479 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -2449,6 +2449,7 @@ font-technology Variable Variables Other Library… Otra biblioteca… Other Script… Otro script… Out of Gamut Warning Aviso de fuera de gama + Show Out-of-Gamut Colors Mostrar colores fuera de gama Out of Web Color Warning Aviso de color no apto para web Out Tangent Handles Manejadores de tangente de salida Outer Glow… Resplandor exterior… diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index f6db5b8ee1..403ae26e7d 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -1651,6 +1651,7 @@ digits Malayalam Malajalam Create New Swatch… Luo uusi värimalli… Name 40% Nimi 40% Out of Gamut Warning Väriavaruuden ulkopuolella -varoitus + Show Out-of-Gamut Colors Näytä väriavaruuden ulkopuoliset värit Out of Web Color Warning Verkkovärien ulkopuolella -varoitus Web Safe RGB Verkkoturvallinen RGB {warning}: click to correct to the closest color ({hex}) {warning}: korjaa lähimpään väriin ({hex}) napsauttamalla diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index ae0bf3b436..9051184455 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -2441,6 +2441,7 @@ font-technology Variable Variables Other Library… Autre bibliothèque… Other Script… Autre script… Out of Gamut Warning Avertissement hors gamme + Show Out-of-Gamut Colors Afficher les couleurs hors gamme Out of Web Color Warning Avertissement de couleur non Web Out Tangent Handles Poignées de tangente sortantes Outer Glow… Lueur externe… diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index f38612601c..091ee4b820 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -4229,6 +4229,7 @@ Box Channel બૉક્સ ચેનલ Color box રંગ બૉક્સ Color Wheel Options રંગ વ્હીલ વિકલ્પો + Show Out-of-Gamut Colors ગેમટ બહારના રંગો બતાવો {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 624671acca..9aa23621d7 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -3287,6 +3287,7 @@ antiAlias Sharp शार्प Other Library… अन्य लाइब्रेरी… Other Script… अन्य स्क्रिप्ट… Out of Gamut Warning गैमट से बाहर होने की चेतावनी + Show Out-of-Gamut Colors गैमट से बाहर के रंग दिखाएँ Out of Web Color Warning वेब कलर चेतावनी से बाहर Out Tangent Handles आउट टैंगेंट हैंडल Out: आउटपुट: diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 3e8a200697..c7a29fd383 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -2923,6 +2923,7 @@ file-filter Templates Sablonok Other Library… Másik könyvtár… Other Script… Másik szkript… Out of Gamut Warning Színtartományon kívüli szín figyelmeztetés + Show Out-of-Gamut Colors Színtartományon kívüli színek megjelenítése Out of Web Color Warning Nem webbiztos szín figyelmeztetés Out Tangent Handles Kimenő érintőfogantyúk Outer Corner Tile Külső sarokcsempe diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 2107a23bf0..f5ae5ba704 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -1584,6 +1584,7 @@ digits Malayalam Malayalam Create New Swatch… Buat swatch baru… Name 40% Nama 40% Out of Gamut Warning Peringatan di luar gamut + Show Out-of-Gamut Colors Tampilkan warna di luar gamut Out of Web Color Warning Peringatan di luar warna web Web Safe RGB RGB aman web {warning}: click to correct to the closest color ({hex}) {warning}: klik untuk mengoreksi ke warna terdekat ({hex}) diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index f75dc629db..e29bc3b9a8 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -2487,6 +2487,7 @@ file-filter Templates Modelli Other Library… Altra libreria… Other Script… Altro script… Out of Gamut Warning Avviso fuori gamma + Show Out-of-Gamut Colors Mostra colori fuori gamma Out of Web Color Warning Avviso colore non web Out Tangent Handles Maniglie tangente in uscita Outer Glow… Bagliore esterno… diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 67072cc8b3..04a6995169 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3946,6 +3946,7 @@ file-filter Templates テンプレート Offset X X 軸オフセット Other Libraries その他のライブラリ Out of Gamut Warning 色域外警告 + Show Out-of-Gamut Colors 色域外のカラーを表示 Out of Web Color Warning Web カラー外警告 Output 出力 Output Black 出力ブラック diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index c8513b84c3..04833fad62 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -1522,6 +1522,7 @@ digits Malayalam მალაიალამური Create New Swatch… ახალი ფერის ნიმუშის შექმნა… Name 40% სახელი 40% Out of Gamut Warning ფერთა გამიდან გასვლის გაფრთხილება + Show Out-of-Gamut Colors ფერთა გამის გარეთ მყოფი ფერების ჩვენება Out of Web Color Warning გაფრთხილება: ფერი ვებფერი არ არის Web Safe RGB ვებისთვის უსაფრთხო RGB {warning}: click to correct to the closest color ({hex}) {warning}: დაწკაპეთ უახლოეს ფერზე ჩასასწორებლად ({hex}) diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 8aa0bc41ca..3ed5f27dc1 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3934,6 +3934,7 @@ file-filter Templates 템플릿 Offset X X 오프셋 Other Libraries 기타 라이브러리 Out of Gamut Warning 색상 범위 초과 경고 + Show Out-of-Gamut Colors 색상 범위를 벗어난 색상 표시 Out of Web Color Warning 웹 색상 초과 경고 Output 출력 Output Black 출력 검정 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index de5b7a3cf6..5fa7387727 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -2102,6 +2102,7 @@ digits Malayalam Malayalam Create New Swatch… Nieuw staal maken… Name 40% Naam 40% Out of Gamut Warning Waarschuwing buiten gamut + Show Out-of-Gamut Colors Kleuren buiten gamut tonen Out of Web Color Warning Waarschuwing buiten webkleur Web Safe RGB Websafe RGB {warning}: click to correct to the closest color ({hex}) {warning}: klik om te corrigeren naar de dichtstbijzijnde kleur ({hex}) diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index f9bdc664f1..e688a7e247 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -1590,6 +1590,7 @@ digits Malayalam Malajalam Create New Swatch… Utwórz nową próbkę… Name 40% Nazwa 40% Out of Gamut Warning Ostrzeżenie: poza gamutem + Show Out-of-Gamut Colors Pokaż kolory poza gamutem Out of Web Color Warning Ostrzeżenie: poza kolorami WWW Web Safe RGB RGB bezpieczne dla WWW {warning}: click to correct to the closest color ({hex}) {warning}: kliknij, aby poprawić na najbliższy kolor ({hex}) diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 07cd9c6fd6..bbc1037db2 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -5110,6 +5110,7 @@ axis Both Ambos Opacity: Default Opacidade: Padrão Other Libraries Outras Bibliotecas Out of Gamut Warning Aviso de Fora do Gamut + Show Out-of-Gamut Colors Mostrar Cores Fora do Gamut Out of Web Color Warning Aviso de Cor Fora da Web Output Saída Output Black Preto de Saída diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index fcf44192cd..bc60fa7dd8 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -2474,6 +2474,7 @@ file-filter Templates Шаблоны Other Library… Другая библиотека… Other Script… Другая письменность… Out of Gamut Warning Предупреждение о выходе из цветового охвата + Show Out-of-Gamut Colors Показать цвета вне цветового охвата Out of Web Color Warning Предупреждение о цвете, не поддерживаемом web Out Tangent Handles Маркеры исходящей касательной Outer Glow… Внешнее свечение… diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index d68878734e..32542260bf 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -2388,6 +2388,7 @@ font-technology Variable Variabla Other Library… Annat bibliotek… Other Script… Annat skript… Out of Gamut Warning Färgomfångsvarning + Show Out-of-Gamut Colors Visa färger utanför färgomfånget Out of Web Color Warning Varning för färg utanför webbfärger Out Tangent Handles Utgående tangenthandtag Outer Glow… Yttre glöd… diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index b3c88cc563..5f30f03efa 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -2234,6 +2234,7 @@ shape Open Açık Other Library… Diğer Kütüphane… Other Script… Diğer Komut Dosyası… Out of Gamut Warning Gamut Dışı Uyarısı + Show Out-of-Gamut Colors Gamut Dışı Renkleri Göster Out of Web Color Warning Web Dışı Renk Uyarısı Out Tangent Handles Dışarıya Teğet Tutamaçlar Outer Glow… Dış Parıltı… diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 0ab6257df4..7b4d5b908b 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -2479,6 +2479,7 @@ file-filter Templates Шаблони Other Library… Інша бібліотека… Other Script… Інша писемність… Out of Gamut Warning Попередження про вихід із колірного охоплення + Show Out-of-Gamut Colors Показати кольори поза колірним охопленням Out of Web Color Warning Попередження про колір, що не підтримується web Out Tangent Handles Маркери вихідної дотичної Outer Glow… Зовнішнє свічення… diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 80cc4951cf..c37fd34328 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -2743,6 +2743,7 @@ digits Hindi Hindi Other Library… Thư viện khác… Other Script… Script khác… Out of Gamut Warning Cảnh báo ngoài dải màu + Show Out-of-Gamut Colors Hiện màu ngoài dải màu Out of Web Color Warning Cảnh báo ngoài màu web Out Tangent Handles Tay nắm tiếp tuyến ra Outer Corner Tile Ô góc ngoài diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 9561a51baf..875aabc8d4 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -2342,6 +2342,7 @@ file-filter Templates 模板 Other Library… 其他库… Other Script… 其他脚本… Out of Gamut Warning 超出色域警告 + Show Out-of-Gamut Colors 显示超出色域的颜色 Out of Web Color Warning 非网页安全色警告 Out Tangent Handles 外切线控制手柄 Outer Glow… 外光晕… diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 7489e3d4d9..b53aa1eb91 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -3558,6 +3558,7 @@ file-filter Templates 範本 Other Library… 其他資料庫… Other Script… 其他指令碼… Out of Gamut Warning 超出色域警告 + Show Out-of-Gamut Colors 顯示超出色域的顏色 Out of Web Color Warning 非網頁安全色警告 Out Tangent Handles 外切線控制把手 Outer Glow… 外光暈… diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index d36ecae60f..86cc9281fc 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, gamut?: 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); gamut true grays out the parts of the wheel's square and the box's field whose colors the CMYK space cannot print (the out-of-gamut warning's test, as color.gamutCheck answers it), as Show Out-of-Gamut Colors does, and false shows them again; 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 three 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, gamut}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index d12c89d2af..ba9e187b11 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_gamut; +#[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..80b4dd76f0 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -11,11 +11,16 @@ //! 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 Out-of-Gamut Colors grays out the cells of the wheel's square and the box's field whose +//! colors the CMYK space cannot print, by the out-of-gamut warning's test ([`Cms::out_of_gamut`]), +//! on a [`GAMUT_CELLS`] by [`GAMUT_CELLS`] grid kept until the channel, its value, the color +//! settings or the loaded profiles change. use egui::{Ui, UiBuilder, vec2}; use serde::{Deserialize, Serialize}; use serde_json::{Value, json}; -use vectorcraft_color::cms::{self, Cms}; +use vectorcraft_color::cms::{self, Cms, ColorSettings}; use vectorcraft_color::{Color, Paint, hsb_to_rgb, rgb_to_hsb}; use vectorcraft_doc::{ColorMode, NodeId}; @@ -67,6 +72,14 @@ pub struct Settings { pub view: View, #[serde(serialize_with = "serialize_channel", deserialize_with = "deserialize_channel")] pub channel: Channel, + /// Show Out-of-Gamut Colors: gray out the colors the CMYK space cannot print. + #[serde(deserialize_with = "deserialize_flag")] + pub gamut: bool, +} + +fn deserialize_flag<'de, D: serde::Deserializer<'de>>(d: D) -> Result { + let v = ::deserialize(d)?; + Ok(v.as_bool().unwrap_or_default()) } fn deserialize_view<'de, D: serde::Deserializer<'de>>(d: D) -> Result { @@ -90,11 +103,11 @@ 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", "gamut"]; match p { Value::Null => {} Value::Object(o) => { @@ -113,11 +126,19 @@ 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")?, } + match p.get("gamut") { + None | Some(Value::Null) => {} + Some(v) => { + let key = "gamut"; + set.gamut = v.as_bool().ok_or_else(|| format!("`{key}` must be true or false"))?; + } + } 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 +/// Out-of-Gamut Colors. 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 +155,68 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { } }); }); + ui.separator(); + if menu_item(ui, tl!("Show Out-of-Gamut Colors"), true, set.gamut) { + command(app, &json!({ "gamut": !set.gamut })).ok(); + } +} + +/// The cells across and down of the grid the out-of-gamut shading tests. +pub(crate) const GAMUT_CELLS: usize = 16; + +/// The cells of a field whose colors are out of the CMYK gamut, a row per [`GAMUT_CELLS`] from the +/// top: bit `i` of a row is its cell `i` from the left. +pub(crate) type GamutGrid = [u16; GAMUT_CELLS]; + +/// The out-of-gamut cells of the box of channel `ch` at strip value `z` through `cms`, each tested +/// at its center by the out-of-gamut warning's test ([`Cms::out_of_gamut`]) on the color a pick +/// there stores in the working RGB space. The wheel's square is the box of [`Channel::Hue`] at the +/// ring's hue. +pub(crate) fn gamut_grid(cms: &Cms, ch: Channel, z: f32) -> GamutGrid { + let n = GAMUT_CELLS as f32; + let mut grid = [0; GAMUT_CELLS]; + for (row, bits) in grid.iter_mut().enumerate() { + for col in 0..GAMUT_CELLS { + let (x, y) = ((col as f32 + 0.5) / n, (row as f32 + 0.5) / n); + // A gray has no hue, and the hue a gray keeps does not change its color. + let [r, g, b] = cms.srgb_to_rgb(hsb_to_rgb(box_pick(ch, z, x, y, [0.0; 3]))); + if cms.out_of_gamut(&Color::rgb(r, g, b)) { + *bits |= 1 << col; + } + } + } + grid +} + +/// What the out-of-gamut grid depends on: the channel, its value's bits, the color settings and +/// [`cms::profiles_generation`], which changes when a profile is loaded again under the same name. +pub(crate) type GamutKey = (Channel, u32, ColorSettings, u64); + +/// The grid for `key` from `slot`, computed with `compute` and kept in `slot` when `slot` holds +/// another key's. +pub(crate) fn cached_grid(slot: &mut Option<(GamutKey, GamutGrid)>, key: GamutKey, compute: impl FnOnce() -> GamutGrid) -> GamutGrid { + match slot { + Some((k, grid)) if *k == key => *grid, + _ => { + let grid = compute(); + *slot = Some((key, grid)); + grid + } + } +} + +/// Panel state: the out-of-gamut grid drawn last and its [`GamutKey`]. +pub(crate) const GAMUT: &str = "color-wheel-gamut"; + +/// The out-of-gamut grid of channel `ch` at value `z` through `cms`, kept in the panel state so a +/// frame with the same channel, value, color settings and loaded profiles does not test the colors +/// again. +fn gamut_shade(ui: &Ui, cms: &Cms, ch: Channel, z: f32) -> GamutGrid { + let mut slot = pstate::>(ui.ctx(), GAMUT); + let key = (ch, z.to_bits(), cms.settings().clone(), cms::profiles_generation()); + let grid = cached_grid(&mut slot, key, || gamut_grid(cms, ch, z)); + set_pstate(ui.ctx(), GAMUT, slot); + grid } /// The display values of HSB `hsb` in `ch`'s space, from 0 to 1: hue, saturation and brightness, @@ -180,16 +263,19 @@ fn strip_number(ch: Channel, hsb: [f32; 3]) -> (f64, &'static str, f64) { } /// The box in a `size` × `size` area: the field of channel `ch` and its strip, on HSB `hsb`, with -/// markers when `marked`. Returns the HSB a click, a drag, a key or a screen reader's action picks, -/// and its phase. -fn show_box(ui: &mut Ui, ch: Channel, hsb: [f32; 3], marked: bool, size: f32) -> Option<([f32; 3], Live)> { +/// markers when `marked` and the field's out-of-gamut cells grayed out when `gamut`. Returns the +/// HSB a click, a drag, a key or a screen reader's action picks, and its phase. +fn show_box(ui: &mut Ui, ch: Channel, hsb: [f32; 3], marked: bool, size: f32, gamut: Option<&Cms>) -> Option<([f32; 3], Live)> { let (z, x, y) = box_pos(ch, hsb); let mut pick = None; + let grid = gamut.map(|cms| gamut_shade(ui, cms, ch, z)); + let shade = grid.as_ref().map_or(&[][..], |g| &g[..]); ui.horizontal_top(|ui| { ui.spacing_mut().item_spacing.x = STRIP_GAP; let field = vec2((size - STRIP_GAP - STRIP).max(1.0), size); let at = |x: f32, y: f32| widgets::hsb32(box_pick(ch, z, x, y, hsb)); - if let (Some((x, y)), phase) = widgets::color_field(ui, "color-wheel-box", (tl!("Color box"), ch.field_axes()), field, (x, y), marked, &at) { + let labels = (tl!("Color box"), ch.field_axes()); + if let (Some((x, y)), phase) = widgets::color_field_shaded(ui, "color-wheel-box", labels, field, (x, y), marked, (&at, shade)) { pick = Some((box_pick(ch, z, x, y, hsb), phase)); } // The hue strip shows the whole spectrum; the others change only their own component. @@ -310,6 +396,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { (c, _) => display_hsb(&cms, &c.unwrap_or(app.session.last_solid)), }; let marked = color.is_some(); + let gamut = app.ui.color_wheel.gamut.then_some(&*cms); let mut pick: Option<([f32; 3], Live)> = None; ui.horizontal_top(|ui| { ui.vertical(|ui| { @@ -318,7 +405,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { }); let size = ui.available_width().min(MAX_WHEEL); if app.ui.color_wheel.view == View::Box { - pick = show_box(ui, app.ui.color_wheel.channel, hsb, marked, size); + pick = show_box(ui, app.ui.color_wheel.channel, hsb, marked, size, gamut); return; } let ring = widgets::hue_ring(ui, "color-wheel-ring", tl!("Hue ring"), size, hsb[0], marked); @@ -328,7 +415,11 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { [FieldAxis { name: tl!("Saturation"), units: 100.0, suffix: "%" }, FieldAxis { name: tl!("Brightness"), units: 100.0, suffix: "%" }]; let at = |x: f32, y: f32| widgets::hsb32([hsb[0], x, 1.0 - y]); let name = tl!("Saturation and brightness"); - let (field, field_phase) = widgets::color_field(&mut field_ui, "field", (name, axes), square.size(), (hsb[1], 1.0 - hsb[2]), marked, &at); + // The square is the hue box at the ring's hue, so it shares the box's grid. + let grid = gamut.map(|cms| gamut_shade(ui, cms, Channel::Hue, box_pos(Channel::Hue, hsb).0)); + let shade = grid.as_ref().map_or(&[][..], |g| &g[..]); + let pos = (hsb[1], 1.0 - hsb[2]); + let (field, field_phase) = widgets::color_field_shaded(&mut field_ui, "field", (name, axes), square.size(), pos, marked, (&at, shade)); if let Some((h, phase)) = ring.hue { pick = Some(([h, hsb[1], hsb[2]], phase)); } 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..4e3ce95d2d 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", "gamut": false})); + assert_eq!(app.run("ui.colorWheel", json!({"view": "box"})).unwrap(), json!({"view": "box", "channel": "hue", "gamut": false})); + assert_eq!(app.run("ui.colorWheel", json!({"channel": "green"})).unwrap(), json!({"view": "box", "channel": "green", "gamut": 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, ..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"], json!({"view": "box", "channel": "green", "gamut": 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, gamut"); 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, gamut"); + 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 +249,8 @@ 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 color_wheel = Settings { view: View::Box, channel: Channel::Blue, ..Default::default() }; + let ui = crate::UiState { color_wheel, 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 +263,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, ..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_gamut.rs b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs new file mode 100644 index 0000000000..0573b5a37f --- /dev/null +++ b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs @@ -0,0 +1,216 @@ +//! The Color Wheel panel's Show Out-of-Gamut Colors: the grid of out-of-gamut cells, its cache, the +//! wheel's square and the box sharing it, `ui.colorWheel {gamut}`, the panel menu and the saved +//! setting. + +use egui::vec2; +use egui_kittest::Harness; +use egui_kittest::kittest::Queryable; +use serde_json::json; +use vectorcraft_color::cms::{self, Cms, ColorSettings}; +use vectorcraft_color::{Color, hsb_to_rgb}; +use vectorcraft_engine::Session; + +use super::color_wheel::{GAMUT, GAMUT_CELLS, GamutGrid, GamutKey, Settings, View, box_pick, cached_grid, gamut_grid, show}; +use crate::VectorcraftApp; +use crate::dialogs::color_picker::Channel; + +/// Whether cell `col` of row `row` (from the top-left) of `grid` is out of gamut. +fn marked(grid: &GamutGrid, col: usize, row: usize) -> bool { + (grid[row] >> col) & 1 == 1 +} + +/// An app with a selected rectangle filled with `fill`, its Color Wheel panel on `view` with Show +/// Out-of-Gamut Colors set to `gamut`. +fn app(fill: &str, view: &str, gamut: bool) -> VectorcraftApp { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap(); + app.run("paint.setFill", json!({"color": fill})).unwrap(); + app.run("ui.colorWheel", json!({"view": view, "channel": "hue", "gamut": gamut})).unwrap(); + 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), app); + h.run_steps(2); + h +} + +/// The grid the panel drew last, with its key. +fn drawn(h: &Harness<'static, VectorcraftApp>) -> Option<(GamutKey, GamutGrid)> { + super::pstate::>(&h.ctx, GAMUT) +} + +/// At hue 240° the field's top-right cell is nearly pure blue, which the CMYK space cannot print, +/// and its bottom-left cell is nearly black, which it can. Each cell is the color a pick at its +/// center stores, tested as the out-of-gamut warning tests it. +#[test] +fn the_hue_grid_marks_blue_and_leaves_black() { + let cms = Cms::default(); + let grid = gamut_grid(&cms, Channel::Hue, 240.0 / 360.0); + let last = GAMUT_CELLS - 1; + assert!(marked(&grid, last, 0), "{grid:04x?}"); + assert!(!marked(&grid, 0, last), "{grid:04x?}"); + for row in 0..GAMUT_CELLS { + for col in 0..GAMUT_CELLS { + let n = GAMUT_CELLS as f32; + let hsb = box_pick(Channel::Hue, 240.0 / 360.0, (col as f32 + 0.5) / n, (row as f32 + 0.5) / n, [0.0; 3]); + let [r, g, b] = cms.srgb_to_rgb(hsb_to_rgb(hsb)); + assert_eq!(marked(&grid, col, row), cms.out_of_gamut(&Color::rgb(r, g, b)), "cell {col}, {row}"); + } + } +} + +/// In the Blue box at full blue, the field's bottom-left cell (no red, no green) is nearly pure +/// blue. +#[test] +fn an_rgb_box_marks_its_own_cells() { + let grid = gamut_grid(&Cms::default(), Channel::Blue, 1.0); + assert!(marked(&grid, 0, GAMUT_CELLS - 1), "{grid:04x?}"); +} + +/// With uncalibrated CMYK as the CMYK space every color counts as printable, as the out-of-gamut +/// warning has it, so no cell is marked. +#[test] +fn uncalibrated_cmyk_marks_nothing() { + let cms = Cms::new(&ColorSettings { cmyk: cms::DEVICE_CMYK.into(), ..ColorSettings::default() }).unwrap(); + assert_eq!(gamut_grid(&cms, Channel::Hue, 240.0 / 360.0), [0; GAMUT_CELLS]); +} + +/// The cache computes a grid once per key: the same channel, value, color settings and profile +/// generation reuse it, and a change of any of them computes it again. +#[test] +fn the_cache_computes_once_per_key() { + let mut slot = None; + let mut runs = 0; + let settings = ColorSettings::default(); + let mut get = |slot: &mut Option<(GamutKey, GamutGrid)>, key: GamutKey| { + cached_grid(slot, key, || { + runs += 1; + [runs; GAMUT_CELLS] + }) + }; + let key = (Channel::Hue, 0.5f32.to_bits(), settings.clone(), 0); + assert_eq!(get(&mut slot, key.clone()), [1; GAMUT_CELLS]); + assert_eq!(get(&mut slot, key.clone()), [1; GAMUT_CELLS], "the same key is not computed again"); + assert_eq!(get(&mut slot, (Channel::Hue, 0.25f32.to_bits(), settings.clone(), 0)), [2; GAMUT_CELLS]); + assert_eq!(get(&mut slot, (Channel::Red, 0.25f32.to_bits(), settings.clone(), 0)), [3; GAMUT_CELLS]); + let device = ColorSettings { cmyk: cms::DEVICE_CMYK.into(), ..settings }; + assert_eq!(get(&mut slot, (Channel::Red, 0.25f32.to_bits(), device.clone(), 0)), [4; GAMUT_CELLS]); + assert_eq!(get(&mut slot, (Channel::Red, 0.25f32.to_bits(), device, 1)), [5; GAMUT_CELLS], "a profile loaded again"); +} + +/// A profile loaded again under the same name can change which colors are printable while the +/// color settings stay the same, so the panel tests the colors again after a profile is +/// registered. +#[test] +fn the_grid_is_computed_again_after_a_profile_is_loaded() { + let mut h = harness(app("#3366cc", "box", true)); + let Some((before, _)) = drawn(&h) else { panic!("the box drew no grid") }; + let name = "Color Wheel Gamut Reload CMYK"; + let bytes = cms::icc_bytes(cms::GENERIC_CMYK).unwrap(); + cms::register_icc(&bytes, Some(name.into())).unwrap(); + h.run_steps(2); + cms::unregister_icc(name); + let Some((after, _)) = drawn(&h) else { panic!("the box drew no grid") }; + assert_eq!((after.0, after.1, &after.2), (before.0, before.1, &before.2)); + assert!(after.3 > before.3, "the key follows the loaded profiles: {} then {}", before.3, after.3); +} + +/// The wheel's square is the hue box at the ring's hue: both draw the same grid, under one key, so +/// a switch between them does not test the colors again. +#[test] +fn the_wheel_and_the_hue_box_shade_the_same_cells() { + let mut h = harness(app("#3366cc", "wheel", true)); + let cms = cms::active(); + let Some((key, grid)) = drawn(&h) else { panic!("the wheel drew no grid") }; + let z = f32::from_bits(key.1); + assert_eq!((key.0, &key.2), (Channel::Hue, cms.settings())); + assert!((z * 360.0 - 220.0).abs() < 0.5, "the ring's hue: {}", z * 360.0); + assert_eq!(grid, gamut_grid(&cms, Channel::Hue, z)); + h.state_mut().run("ui.colorWheel", json!({"view": "box"})).unwrap(); + h.run_steps(2); + // Other tests in this process may register profiles between the frames, which changes the + // key's profile generation; the channel, value, settings and grid stay the same. + let Some((boxed, boxed_grid)) = drawn(&h) else { panic!("the box drew no grid") }; + assert_eq!((boxed.0, boxed.1, &boxed.2, boxed_grid), (key.0, key.1, &key.2, grid)); +} + +/// With Show Out-of-Gamut Colors off, the panel tests no colors. +#[test] +fn with_the_setting_off_no_grid_is_computed() { + let h = harness(app("#3366cc", "box", false)); + assert_eq!(drawn(&h), None); +} + +/// `ui.colorWheel {gamut}` sets the setting and keeps the others; a value that is not true or +/// false is an error that changes nothing, translated where messages are. +#[test] +fn ui_color_wheel_sets_gamut() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("ui.colorWheel", json!({"view": "box"})).unwrap(); + assert_eq!(app.run("ui.colorWheel", json!({"gamut": true})).unwrap(), json!({"view": "box", "channel": "hue", "gamut": true})); + let e = app.run("ui.colorWheel", json!({"view": "wheel", "gamut": "yes"})).unwrap_err(); + assert_eq!(e, "`gamut` must be true or false"); + assert_eq!(app.ui.color_wheel, Settings { view: View::Box, gamut: true, ..Default::default() }, "an error changes nothing"); + assert_eq!(app.run("ui.colorWheel", json!({"gamut": null})).unwrap()["gamut"], json!(true), "null keeps the value"); + assert_eq!(app.run("ui.colorWheel", json!({"gamut": false})).unwrap()["gamut"], json!(false)); + for code in ["de", "fr", "ja", "zh-hans"] { + let lang = crate::i18n::Lang::from_code(code).expect("registered"); + let shown = crate::i18n::message(lang, &e); + assert_ne!(shown, e, "{code}"); + assert!(shown.contains("`gamut`"), "{code}: {shown}"); + } +} + +/// The setting survives a JSON round trip of the preferences, and a saved value that is not true +/// or false reads as off without losing the other settings. +#[test] +fn the_gamut_setting_is_kept_and_read_leniently() { + let ui = crate::UiState { color_wheel: Settings { view: View::Box, gamut: true, ..Default::default() }, ..Default::default() }; + let saved = serde_json::to_value(&ui).unwrap(); + assert_eq!(saved["color_wheel"]["gamut"], json!(true)); + let back: crate::UiState = serde_json::from_value(saved.clone()).unwrap(); + assert_eq!(back.color_wheel, ui.color_wheel); + let mut odd = saved; + odd["color_wheel"] = json!({"view": "box", "channel": "red", "gamut": "yes"}); + let back: crate::UiState = serde_json::from_value(odd).unwrap(); + assert_eq!(back.color_wheel, Settings { view: View::Box, channel: Channel::Red, gamut: false }); +} + +/// The panel menu's Show Out-of-Gamut Colors is checked while the setting is on, and switches it. +#[test] +fn the_panel_menu_switches_the_shading() { + let app = app("#ff0000", "wheel", false); + let mut fonts = false; + let mut h = Harness::builder().with_size(vec2(260.0, 360.0)).build_ui_state( + move |ui, app: &mut VectorcraftApp| { + // The fonts, which draw the check mark, take effect from the next frame. + if !fonts { + crate::theme::install_fonts(ui.ctx()); + fonts = true; + return; + } + assert!(super::panel_menu_items(app, ui, super::color_wheel::ID)); + }, + app, + ); + h.run_steps(3); + h.get_by_label(" Show Out-of-Gamut Colors").click(); + h.run_steps(2); + assert!(h.state().ui.color_wheel.gamut); + assert!(h.query_by_label("✓ Show Out-of-Gamut Colors").is_some()); + h.get_by_label("✓ Show Out-of-Gamut Colors").click(); + h.run_steps(2); + assert!(!h.state().ui.color_wheel.gamut); +} + +/// The edge runs between the marked cells and the others, inside the grid only, and bits past the +/// grid's width are not cells. +#[test] +fn the_edge_runs_between_marked_and_unmarked_cells() { + assert_eq!(crate::widgets::shade_edges(&[0b01, 0b00]), vec![[(1, 0), (1, 1)], [(0, 1), (1, 1)]]); + assert_eq!(crate::widgets::shade_edges(&[0b11, 0b11]), Vec::<[(usize, usize); 2]>::new(), "all marked"); + assert_eq!(crate::widgets::shade_edges(&[0b100]), Vec::<[(usize, usize); 2]>::new(), "bit 2 is past a 1 × 1 grid"); + assert_eq!(crate::widgets::shade_edges(&[]), Vec::<[(usize, usize); 2]>::new()); +} diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index d1722e8b72..278ae0282e 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -734,7 +734,7 @@ 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`, + /// Color Wheel panel: the wheel or the box, the box's channel and the out-of-gamut shading (`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, diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 2ace2c7a67..1c36c9fc1a 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -34,10 +34,12 @@ pub(crate) use buttons::{button_width, icon_button_info, primary_button_width, s #[cfg(test)] 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}; +#[cfg(test)] +pub(crate) use color::shade_edges; 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, + color_field, color_field_shaded, 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, }; 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..21ddb3fb85 100644 --- a/crates/ui-egui/src/widgets/color.rs +++ b/crates/ui-egui/src/widgets/color.rs @@ -383,11 +383,26 @@ fn focus_outline(ui: &Ui, resp: &Response, rect: Rect) { pub fn color_field( ui: &mut Ui, id: impl std::hash::Hash, - (name, axes): (&str, [FieldAxis<'_>; 2]), + labels: (&str, [FieldAxis<'_>; 2]), size: Vec2, pos: (f32, f32), marked: bool, color_at: &dyn Fn(f32, f32) -> Color32, +) -> (Option<(f32, f32)>, Live) { + color_field_shaded(ui, id, labels, size, pos, marked, (color_at, &[])) +} + +/// A [`color_field`] with the cells `shade` marks grayed out under its marker, each run of them +/// edged with a dark and a light line. `shade` holds a row of an n × n grid over the field for each +/// of its n rows (16 at most) from the top, and bit `i` of a row marks its cell `i` from the left. +pub fn color_field_shaded( + ui: &mut Ui, + id: impl std::hash::Hash, + (name, axes): (&str, [FieldAxis<'_>; 2]), + size: Vec2, + pos: (f32, f32), + marked: bool, + (color_at, shade): (&dyn Fn(f32, f32) -> Color32, &[u16]), ) -> (Option<(f32, f32)>, Live) { use egui::accesskit::{Action, ActionData}; let t = Tokens::get(ui.ctx()); @@ -396,6 +411,7 @@ pub fn color_field( focus_on_press(&resp); let painter = ui.painter_at(rect.expand(6.0)); painter.add(color_mesh(rect, (32, 32), color_at)); + shade_cells(&painter, rect, shade); painter.rect_stroke(rect, 0.0, Stroke::new(1.0, t.border), StrokeKind::Outside); focus_outline(ui, &resp, rect); let (x, y) = pos; @@ -446,6 +462,55 @@ pub fn color_field( (None, Live::Idle) } +/// The gray over a shaded cell of a [`color_field_shaded`]. +const SHADE: Color32 = Color32::from_rgba_premultiplied(96, 96, 96, 192); + +/// Whether cell `col` of row `row` of `shade` is marked; a cell outside the grid is not. +fn shaded(shade: &[u16], col: usize, row: usize) -> bool { + col < shade.len().min(16) && shade.get(row).is_some_and(|bits| (bits >> col) & 1 == 1) +} + +/// The lines between the marked and the unmarked cells of `shade` (see [`color_field_shaded`]), +/// each from one grid point to the next, as (column, row) from the top-left corner. +pub(crate) fn shade_edges(shade: &[u16]) -> Vec<[(usize, usize); 2]> { + let n = shade.len().min(16); + let mut edges = Vec::new(); + for row in 0..n { + for col in 0..n { + let here = shaded(shade, col, row); + if col + 1 < n && here != shaded(shade, col + 1, row) { + edges.push([(col + 1, row), (col + 1, row + 1)]); + } + if row + 1 < n && here != shaded(shade, col, row + 1) { + edges.push([(col, row + 1), (col + 1, row + 1)]); + } + } + } + edges +} + +/// Gray out the cells `shade` marks over `rect`, and draw the lines between them and the others +/// dark under light. +fn shade_cells(painter: &egui::Painter, rect: Rect, shade: &[u16]) { + let n = shade.len().min(16); + if n == 0 { + return; + } + let cell = rect.size() / n as f32; + let at = |(col, row): (usize, usize)| rect.min + vec2(col as f32 * cell.x, row as f32 * cell.y); + for row in 0..n { + for col in (0..n).filter(|&col| shaded(shade, col, row)) { + painter.rect_filled(Rect::from_min_size(at((col, row)), cell), 0.0, SHADE); + } + } + let edges = shade_edges(shade); + for stroke in [Stroke::new(2.0, Color32::BLACK), Stroke::new(1.0, Color32::WHITE)] { + for [a, b] in &edges { + painter.line_segment([at(*a), at(*b)], stroke); + } + } +} + /// A smoothly shaded colour area: a `cols` × `rows` grid over `rect` with `color_at(x, y)` (0..1 /// each, y down) at its vertices. pub fn color_mesh(rect: Rect, (cols, rows): (u32, u32), color_at: &dyn Fn(f32, f32) -> Color32) -> egui::Shape { diff --git a/docs/control-protocol.md b/docs/control-protocol.md index bb13e0d5f5..de4288cd23 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -265,9 +265,9 @@ My Themes tab lists the saved themes; every action runs a command (`colorTheme.s Color Wheel panel (`window.panel {panel: "colorWheel"}`): a hue ring around a saturation and brightness square. A pick runs the commands the Color panel's sliders run: `paint.setFill` or `paint.setStroke` with `keepModel`, `paint.editGradient` for a gradient's selected stop, and `paint.freeform.setPoint` for a freeform gradient's selected -point (the first stop or point when none is selected). `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?, gamut?}` shows the wheel or +the box (a color field with a channel strip at its right), picks the box's channel, and with `gamut` grays out the +colors the CMYK space cannot print; 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 12c1f38184..68e99c7232 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -622,9 +622,11 @@ 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. `"gamut": true` grays out the parts of the wheel's square and the box's field whose colors +the CMYK space cannot print, as the panel menu's Show Out-of-Gamut Colors does, and `false` shows them again. The +test is the out-of-gamut warning's, which `color.gamutCheck` answers for one color. 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, gamut}`, 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..fe0563ea9e 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. Show Out-of-Gamut Colors grays out the parts of the square and the box's field whose colors the CMYK space cannot print, by the out-of-gamut warning's test on a 16 by 16 grid (`ui.colorWheel {gamut}`). 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`. From 5589f629d4478215c70992f8ea0098e544429bc4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 08:57:06 -0800 Subject: [PATCH 2/5] Color Wheel: catalog row with the panel's rows, and test cleanup - The "Show Out-of-Gamut Colors" row moves next to the other Color Wheel rows in each catalog, out of the alphabetical block it had split. - The `gamut_grid` doc comment says the cells are tested on the working-RGB color of a pick, before it is converted to CMYK or Lab. - The profile test unregisters its ICC profile in a drop guard, so a failed assertion does not leave it registered for other tests. - The `color_wheel` field's doc comment in `state.rs` is rewrapped. --- crates/ui-egui/src/i18n/bg.tsv | 2 +- crates/ui-egui/src/i18n/bs.tsv | 2 +- crates/ui-egui/src/i18n/ca.tsv | 2 +- crates/ui-egui/src/i18n/cs.tsv | 2 +- crates/ui-egui/src/i18n/da.tsv | 2 +- crates/ui-egui/src/i18n/de.tsv | 2 +- crates/ui-egui/src/i18n/el.tsv | 2 +- crates/ui-egui/src/i18n/es.tsv | 2 +- crates/ui-egui/src/i18n/fi.tsv | 2 +- crates/ui-egui/src/i18n/fr.tsv | 2 +- crates/ui-egui/src/i18n/hi.tsv | 2 +- crates/ui-egui/src/i18n/hu.tsv | 2 +- crates/ui-egui/src/i18n/id.tsv | 2 +- crates/ui-egui/src/i18n/it.tsv | 2 +- crates/ui-egui/src/i18n/ja.tsv | 2 +- crates/ui-egui/src/i18n/ka.tsv | 2 +- crates/ui-egui/src/i18n/ko.tsv | 2 +- crates/ui-egui/src/i18n/nl.tsv | 2 +- crates/ui-egui/src/i18n/pl.tsv | 2 +- crates/ui-egui/src/i18n/pt-br.tsv | 2 +- crates/ui-egui/src/i18n/ru.tsv | 2 +- crates/ui-egui/src/i18n/sv.tsv | 2 +- crates/ui-egui/src/i18n/tr.tsv | 2 +- crates/ui-egui/src/i18n/uk.tsv | 2 +- crates/ui-egui/src/i18n/vi.tsv | 2 +- crates/ui-egui/src/i18n/zh-hans.tsv | 2 +- crates/ui-egui/src/i18n/zh-hant.tsv | 2 +- crates/ui-egui/src/panels/color_wheel.rs | 6 +++--- crates/ui-egui/src/panels/tests_color_wheel_gamut.rs | 9 ++++++++- crates/ui-egui/src/state.rs | 4 ++-- 30 files changed, 40 insertions(+), 33 deletions(-) diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index c3c5c14d79..36488e4c37 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -562,6 +562,7 @@ font-technology Variable Променливи Box Channel Канал на квадрата Color box Цветови квадрат Color Wheel Options Опции на цветното колело + Show Out-of-Gamut Colors Показване на цветовете извън цветовата гама Color Type: Цветен тип: Color: Цвят: Colorize Оцветяване @@ -2373,7 +2374,6 @@ font-technology Variable Променливи The Scripts folder cannot be read Папката Scripts не може да бъде прочетена Other Script… Друг скрипт… Out of Gamut Warning Предупреждение за излизане извън цветовата гама - Show Out-of-Gamut Colors Показване на цветовете извън цветовата гама Out of Web Color Warning Предупреждение за цвят извън уеб палитрата Out Tangent Handles Външни тангентни дръжки Outer Glow… Външно разсейване… diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index f63d89b0ad..eee2cb2b4d 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -740,6 +740,7 @@ Box Channel Kanal kvadrata Color box Kvadrat boje Color Wheel Options Opcije kotača boja + Show Out-of-Gamut Colors Prikaži boje izvan gamuta CSS Properties CSS svojstva Document Info Informacije o dokumentu Flattener Preview Pregled spljoštavanja @@ -1649,7 +1650,6 @@ digits Malayalam Malajalam Create New Swatch… Kreiraj novi uzorak boje… Name 40% Naziv 40% Out of Gamut Warning Upozorenje o izlasku iz gamuta - Show Out-of-Gamut Colors Prikaži boje izvan gamuta Out of Web Color Warning Upozorenje o boji izvan weba Web Safe RGB Sigurni web RGB {warning}: click to correct to the closest color ({hex}) {warning}: kliknite za ispravku na najbližu boju ({hex}) diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index d0f028a97b..6f7a5b84fa 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -824,6 +824,7 @@ antiAlias Sharp Nítid Box Channel Canal del quadre Color box Quadre de color Color Wheel Options Opcions de la roda de colors + Show Out-of-Gamut Colors Mostra els colors fora de gama Color Type: Tipus de color: Color wheel Roda de color Color: Color: @@ -3010,7 +3011,6 @@ digits Malayalam Malaiàlam Other Library… Una altra biblioteca… Other Script… Un altre script… Out of Gamut Warning Avís fora de gama - Show Out-of-Gamut Colors Mostra els colors fora de gama Out of Web Color Warning Avís fora dels colors web Out Tangent Handles Nanses tangents de sortida Outer Corner Tile Mosaic de cantonada exterior diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 7ee7411790..aec29f9ab7 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -753,6 +753,7 @@ Box Channel Kanál čtverce Color box Barevný čtverec Color Wheel Options Možnosti barevného kola + Show Out-of-Gamut Colors Zobrazit barvy mimo gamut CSS Properties Vlastnosti CSS Document Info Informace o dokumentu Flattener Preview Náhled sloučení @@ -1678,7 +1679,6 @@ digits Malayalam Malajálamské Create New Swatch… Vytvořit novou položku vzorníku… Name 40% Název 40 % Out of Gamut Warning Upozornění na barvu mimo gamut - Show Out-of-Gamut Colors Zobrazit barvy mimo gamut Out of Web Color Warning Upozornění na barvu mimo webovou paletu Web Safe RGB Webově bezpečné RGB {warning}: click to correct to the closest color ({hex}) {warning}: kliknutím opravíte na nejbližší barvu ({hex}) diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index bc38e95000..ca095adf83 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -698,6 +698,7 @@ Box Channel Kvadratets kanal Color box Farvekvadrat Color Wheel Options Indstillinger for farvehjul + Show Out-of-Gamut Colors Vis farver uden for gamut CSS Properties CSS-egenskaber Document Info Dokumentoplysninger Flattener Preview Udjævningsforhåndsvisning @@ -1584,7 +1585,6 @@ digits Malayalam Malayalam Create New Swatch… Opret ny farveprøve… Name 40% Navn 40% Out of Gamut Warning Advarsel: uden for gamut - Show Out-of-Gamut Colors Vis farver uden for gamut Out of Web Color Warning Advarsel: ikke-websikker farve Web Safe RGB Websikker RGB {warning}: click to correct to the closest color ({hex}) {warning}: klik for at rette til den nærmeste farve ({hex}) diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 6802775e29..2ce633fe27 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -555,6 +555,7 @@ font-technology Variable Variabel Box Channel Kanal des Quadrats Color box Farbquadrat Color Wheel Options Optionen für den Farbkreis + Show Out-of-Gamut Colors Farben außerhalb des Farbumfangs einblenden Color Type: Farbart: Color: Farbe: Colorize Einfärben @@ -2411,7 +2412,6 @@ file-filter Templates Vorlagen Other Library… Andere Bibliothek… Other Script… Anderes Skript… Out of Gamut Warning Warnung: außerhalb des Farbumfangs - Show Out-of-Gamut Colors Farben außerhalb des Farbumfangs einblenden Out of Web Color Warning Warnung: keine Webfarbe Out Tangent Handles Ausgehende Tangentengriffe Outer Glow… Schein nach außen… diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 9a9b9bcbef..e69fb91d61 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -537,6 +537,7 @@ font-technology Variable Μεταβλητές Box Channel Κανάλι τετραγώνου Color box Τετράγωνο χρώματος Color Wheel Options Επιλογές χρωματικού τροχού + Show Out-of-Gamut Colors Εμφάνιση χρωμάτων εκτός χρωματικής γκάμας Color Type: Τύπος χρώματος: Color: Χρώμα: Colorize Χρωματισμός @@ -3273,7 +3274,6 @@ theme Appearance Εμφάνιση Other Library… Άλλη βιβλιοθήκη… Other Script… Άλλο σενάριο… Out of Gamut Warning Προειδοποίηση εκτός χρωματικής γκάμας - Show Out-of-Gamut Colors Εμφάνιση χρωμάτων εκτός χρωματικής γκάμας Out of Web Color Warning Προειδοποίηση εκτός χρωμάτων ιστού Out Tangent Handles Λαβές εξερχόμενης εφαπτομένης Outline Others Περιγράμματα άλλων diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 2580f20479..2e3db2a871 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -577,6 +577,7 @@ font-technology Variable Variables Box Channel Canal del cuadro Color box Cuadro de color Color Wheel Options Opciones de la rueda de color + Show Out-of-Gamut Colors Mostrar colores fuera de gama Color Type: Tipo de color: Color: Color: Colorize Colorear @@ -2449,7 +2450,6 @@ font-technology Variable Variables Other Library… Otra biblioteca… Other Script… Otro script… Out of Gamut Warning Aviso de fuera de gama - Show Out-of-Gamut Colors Mostrar colores fuera de gama Out of Web Color Warning Aviso de color no apto para web Out Tangent Handles Manejadores de tangente de salida Outer Glow… Resplandor exterior… diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 403ae26e7d..b94e5bef08 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -744,6 +744,7 @@ Box Channel Ruudun kanava Color box Väriruutu Color Wheel Options Väriympyrän asetukset + Show Out-of-Gamut Colors Näytä väriavaruuden ulkopuoliset värit CSS Properties CSS-ominaisuudet Document Info Asiakirjan tiedot Flattener Preview Litistyksen esikatselu @@ -1651,7 +1652,6 @@ digits Malayalam Malajalam Create New Swatch… Luo uusi värimalli… Name 40% Nimi 40% Out of Gamut Warning Väriavaruuden ulkopuolella -varoitus - Show Out-of-Gamut Colors Näytä väriavaruuden ulkopuoliset värit Out of Web Color Warning Verkkovärien ulkopuolella -varoitus Web Safe RGB Verkkoturvallinen RGB {warning}: click to correct to the closest color ({hex}) {warning}: korjaa lähimpään väriin ({hex}) napsauttamalla diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 9051184455..98451403b1 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -578,6 +578,7 @@ font-technology Variable Variables Box Channel Couche du carré Color box Carré de couleur Color Wheel Options Options de la roue chromatique + Show Out-of-Gamut Colors Afficher les couleurs hors gamme Color Type: Type de couleur : Color: Couleur : Colorize Coloriser @@ -2441,7 +2442,6 @@ font-technology Variable Variables Other Library… Autre bibliothèque… Other Script… Autre script… Out of Gamut Warning Avertissement hors gamme - Show Out-of-Gamut Colors Afficher les couleurs hors gamme Out of Web Color Warning Avertissement de couleur non Web Out Tangent Handles Poignées de tangente sortantes Outer Glow… Lueur externe… diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 9aa23621d7..008c4026dd 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -948,6 +948,7 @@ antiAlias Sharp शार्प Box Channel बॉक्स चैनल Color box कलर बॉक्स Color Wheel Options कलर व्हील ऑप्शन्स + Show Out-of-Gamut Colors गैमट से बाहर के रंग दिखाएँ Color Type: रंग का प्रकार: Color wheel कलर व्हील Color: रंग: @@ -3287,7 +3288,6 @@ antiAlias Sharp शार्प Other Library… अन्य लाइब्रेरी… Other Script… अन्य स्क्रिप्ट… Out of Gamut Warning गैमट से बाहर होने की चेतावनी - Show Out-of-Gamut Colors गैमट से बाहर के रंग दिखाएँ Out of Web Color Warning वेब कलर चेतावनी से बाहर Out Tangent Handles आउट टैंगेंट हैंडल Out: आउटपुट: diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index c7a29fd383..5dba6b02aa 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -753,6 +753,7 @@ 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 Out-of-Gamut Colors Színtartományon kívüli színek megjelenítése Color Type: Színtípus: Color: Szín: Colorization Színezés @@ -2923,7 +2924,6 @@ file-filter Templates Sablonok Other Library… Másik könyvtár… Other Script… Másik szkript… Out of Gamut Warning Színtartományon kívüli szín figyelmeztetés - Show Out-of-Gamut Colors Színtartományon kívüli színek megjelenítése Out of Web Color Warning Nem webbiztos szín figyelmeztetés Out Tangent Handles Kimenő érintőfogantyúk Outer Corner Tile Külső sarokcsempe diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index f5ae5ba704..e91af7ace4 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -698,6 +698,7 @@ Box Channel Saluran kotak Color box Kotak warna Color Wheel Options Opsi roda warna + Show Out-of-Gamut Colors Tampilkan warna di luar gamut CSS Properties Properti CSS Document Info Info dokumen Flattener Preview Pratinjau perata @@ -1584,7 +1585,6 @@ digits Malayalam Malayalam Create New Swatch… Buat swatch baru… Name 40% Nama 40% Out of Gamut Warning Peringatan di luar gamut - Show Out-of-Gamut Colors Tampilkan warna di luar gamut Out of Web Color Warning Peringatan di luar warna web Web Safe RGB RGB aman web {warning}: click to correct to the closest color ({hex}) {warning}: klik untuk mengoreksi ke warna terdekat ({hex}) diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index e29bc3b9a8..27c45f98e5 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -577,6 +577,7 @@ font-technology Variable Variabili Box Channel Canale del riquadro Color box Riquadro colore Color Wheel Options Opzioni ruota dei colori + Show Out-of-Gamut Colors Mostra colori fuori gamma Color Type: Tipo di colore: Color: Colore: Colorize Colora @@ -2487,7 +2488,6 @@ file-filter Templates Modelli Other Library… Altra libreria… Other Script… Altro script… Out of Gamut Warning Avviso fuori gamma - Show Out-of-Gamut Colors Mostra colori fuori gamma Out of Web Color Warning Avviso colore non web Out Tangent Handles Maniglie tangente in uscita Outer Glow… Bagliore esterno… diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 04a6995169..ab10f2a379 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -768,6 +768,7 @@ digits Malayalam マラヤーラム数字 Box Channel ボックスのチャンネル Color box カラーボックス Color Wheel Options カラーホイールオプション + Show Out-of-Gamut Colors 色域外のカラーを表示 CSS Properties CSS プロパティ Document Info ドキュメント情報 Flattener Preview 分割・統合プレビュー @@ -3946,7 +3947,6 @@ file-filter Templates テンプレート Offset X X 軸オフセット Other Libraries その他のライブラリ Out of Gamut Warning 色域外警告 - Show Out-of-Gamut Colors 色域外のカラーを表示 Out of Web Color Warning Web カラー外警告 Output 出力 Output Black 出力ブラック diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 04833fad62..6a9a3019a3 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -664,6 +664,7 @@ Box Channel კვადრატის არხი Color box ფერის კვადრატი Color Wheel Options ფერთა წრის პარამეტრები + Show Out-of-Gamut Colors ფერთა გამის გარეთ მყოფი ფერების ჩვენება CSS Properties CSS თვისებები Document Info დოკუმენტის ინფორმაცია Flattener Preview გაბრტყელების წინასწარი ნახვა @@ -1522,7 +1523,6 @@ digits Malayalam მალაიალამური Create New Swatch… ახალი ფერის ნიმუშის შექმნა… Name 40% სახელი 40% Out of Gamut Warning ფერთა გამიდან გასვლის გაფრთხილება - Show Out-of-Gamut Colors ფერთა გამის გარეთ მყოფი ფერების ჩვენება Out of Web Color Warning გაფრთხილება: ფერი ვებფერი არ არის Web Safe RGB ვებისთვის უსაფრთხო RGB {warning}: click to correct to the closest color ({hex}) {warning}: დაწკაპეთ უახლოეს ფერზე ჩასასწორებლად ({hex}) diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 3ed5f27dc1..097412b714 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -761,6 +761,7 @@ digits Malayalam 말라얄람어 Box Channel 상자 채널 Color box 색상 상자 Color Wheel Options 색상환 옵션 + Show Out-of-Gamut Colors 색상 범위를 벗어난 색상 표시 CSS Properties CSS 속성 Document Info 문서 정보 Flattener Preview 병합 미리 보기 @@ -3934,7 +3935,6 @@ file-filter Templates 템플릿 Offset X X 오프셋 Other Libraries 기타 라이브러리 Out of Gamut Warning 색상 범위 초과 경고 - Show Out-of-Gamut Colors 색상 범위를 벗어난 색상 표시 Out of Web Color Warning 웹 색상 초과 경고 Output 출력 Output Black 출력 검정 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 5fa7387727..0161a073f8 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1216,6 +1216,7 @@ Box Channel Kanaal van het vak Color box Kleurvak Color Wheel Options Opties voor kleurenwiel + Show Out-of-Gamut Colors Kleuren buiten gamut tonen CSS Properties CSS-eigenschappen Document Info Documentinfo Flattener Preview Afvlakvoorbeeld @@ -2102,7 +2103,6 @@ digits Malayalam Malayalam Create New Swatch… Nieuw staal maken… Name 40% Naam 40% Out of Gamut Warning Waarschuwing buiten gamut - Show Out-of-Gamut Colors Kleuren buiten gamut tonen Out of Web Color Warning Waarschuwing buiten webkleur Web Safe RGB Websafe RGB {warning}: click to correct to the closest color ({hex}) {warning}: klik om te corrigeren naar de dichtstbijzijnde kleur ({hex}) diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index e688a7e247..f2aa40a565 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -702,6 +702,7 @@ Box Channel Kanał kwadratu Color box Kwadrat koloru Color Wheel Options Opcje koła kolorów + Show Out-of-Gamut Colors Pokaż kolory poza gamutem CSS Properties Właściwości CSS Document Info Informacje o dokumencie Flattener Preview Podgląd spłaszczania @@ -1590,7 +1591,6 @@ digits Malayalam Malajalam Create New Swatch… Utwórz nową próbkę… Name 40% Nazwa 40% Out of Gamut Warning Ostrzeżenie: poza gamutem - Show Out-of-Gamut Colors Pokaż kolory poza gamutem Out of Web Color Warning Ostrzeżenie: poza kolorami WWW Web Safe RGB RGB bezpieczne dla WWW {warning}: click to correct to the closest color ({hex}) {warning}: kliknij, aby poprawić na najbliższy kolor ({hex}) diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index bbc1037db2..c08a266e9f 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -522,6 +522,7 @@ antiAlias Sharp Nítido Box Channel Canal da Caixa Color box Caixa de cor Color Wheel Options Opções da Roda de Cores + Show Out-of-Gamut Colors Mostrar Cores Fora do Gamut Color Type: Tipo de Cor: Color blindness – Deuteranopia-type Daltonismo – tipo deuteranopia Color blindness – Protanopia-type Daltonismo – tipo protanopia @@ -5110,7 +5111,6 @@ axis Both Ambos Opacity: Default Opacidade: Padrão Other Libraries Outras Bibliotecas Out of Gamut Warning Aviso de Fora do Gamut - Show Out-of-Gamut Colors Mostrar Cores Fora do Gamut Out of Web Color Warning Aviso de Cor Fora da Web Output Saída Output Black Preto de Saída diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index bc60fa7dd8..3bd0a834c1 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -575,6 +575,7 @@ font-technology Variable Вариативные Box Channel Канал квадрата Color box Цветовой квадрат Color Wheel Options Параметры цветового круга + Show Out-of-Gamut Colors Показать цвета вне цветового охвата Color Type: Тип цвета: Color: Цвет: Colorize Тонировать @@ -2474,7 +2475,6 @@ file-filter Templates Шаблоны Other Library… Другая библиотека… Other Script… Другая письменность… Out of Gamut Warning Предупреждение о выходе из цветового охвата - Show Out-of-Gamut Colors Показать цвета вне цветового охвата Out of Web Color Warning Предупреждение о цвете, не поддерживаемом web Out Tangent Handles Маркеры исходящей касательной Outer Glow… Внешнее свечение… diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 32542260bf..8e7fbfe533 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -564,6 +564,7 @@ font-technology Variable Variabla Box Channel Rutans kanal Color box Färgruta Color Wheel Options Alternativ för färghjulet + Show Out-of-Gamut Colors Visa färger utanför färgomfånget Color Type: Färgtyp: Color: Färg: Colorize Färglägg @@ -2388,7 +2389,6 @@ font-technology Variable Variabla Other Library… Annat bibliotek… Other Script… Annat skript… Out of Gamut Warning Färgomfångsvarning - Show Out-of-Gamut Colors Visa färger utanför färgomfånget Out of Web Color Warning Varning för färg utanför webbfärger Out Tangent Handles Utgående tangenthandtag Outer Glow… Yttre glöd… diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 5f30f03efa..eafcee0d19 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -558,6 +558,7 @@ font-technology Variable Değişken Box Channel Kutu Kanalı Color box Renk kutusu Color Wheel Options Renk Tekerleği Seçenekleri + Show Out-of-Gamut Colors Gamut Dışı Renkleri Göster Color Type: Renk Türü: Color: Renk: Colorize Renklendir @@ -2234,7 +2235,6 @@ shape Open Açık Other Library… Diğer Kütüphane… Other Script… Diğer Komut Dosyası… Out of Gamut Warning Gamut Dışı Uyarısı - Show Out-of-Gamut Colors Gamut Dışı Renkleri Göster Out of Web Color Warning Web Dışı Renk Uyarısı Out Tangent Handles Dışarıya Teğet Tutamaçlar Outer Glow… Dış Parıltı… diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 7b4d5b908b..760b927ada 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -571,6 +571,7 @@ font-technology Variable Варіативні Box Channel Канал квадрата Color box Колірний квадрат Color Wheel Options Параметри колірного кола + Show Out-of-Gamut Colors Показати кольори поза колірним охопленням Color Type: Тип кольору: Color: Колір: Colorize Тонувати @@ -2479,7 +2480,6 @@ file-filter Templates Шаблони Other Library… Інша бібліотека… Other Script… Інша писемність… Out of Gamut Warning Попередження про вихід із колірного охоплення - Show Out-of-Gamut Colors Показати кольори поза колірним охопленням Out of Web Color Warning Попередження про колір, що не підтримується web Out Tangent Handles Маркери вихідної дотичної Outer Glow… Зовнішнє свічення… diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index c37fd34328..bb25880b0a 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -664,6 +664,7 @@ 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 Out-of-Gamut Colors Hiện màu ngoài dải màu Color Type: Loại màu: Color: Màu: Colorization Tô màu @@ -2743,7 +2744,6 @@ digits Hindi Hindi Other Library… Thư viện khác… Other Script… Script khác… Out of Gamut Warning Cảnh báo ngoài dải màu - Show Out-of-Gamut Colors Hiện màu ngoài dải màu Out of Web Color Warning Cảnh báo ngoài màu web Out Tangent Handles Tay nắm tiếp tuyến ra Outer Corner Tile Ô góc ngoài diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 875aabc8d4..305599550d 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -523,6 +523,7 @@ antiAlias Sharp 锐利 Box Channel 方块色版 Color box 颜色方块 Color Wheel Options 色轮选项 + Show Out-of-Gamut Colors 显示超出色域的颜色 Color Type: 颜色类型: Color: 颜色: Colorize 上色 @@ -2342,7 +2343,6 @@ file-filter Templates 模板 Other Library… 其他库… Other Script… 其他脚本… Out of Gamut Warning 超出色域警告 - Show Out-of-Gamut Colors 显示超出色域的颜色 Out of Web Color Warning 非网页安全色警告 Out Tangent Handles 外切线控制手柄 Outer Glow… 外光晕… diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index b53aa1eb91..3144392377 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -540,6 +540,7 @@ font-technology Variable 可變 Box Channel 方塊色版 Color box 顏色方塊 Color Wheel Options 色輪選項 + Show Out-of-Gamut Colors 顯示超出色域的顏色 Color Type: 顏色類型: Color: 顏色: Colorize 上色 @@ -3558,7 +3559,6 @@ file-filter Templates 範本 Other Library… 其他資料庫… Other Script… 其他指令碼… Out of Gamut Warning 超出色域警告 - Show Out-of-Gamut Colors 顯示超出色域的顏色 Out of Web Color Warning 非網頁安全色警告 Out Tangent Handles 外切線控制把手 Outer Glow… 外光暈… diff --git a/crates/ui-egui/src/panels/color_wheel.rs b/crates/ui-egui/src/panels/color_wheel.rs index 80b4dd76f0..14cc4ebab1 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -169,9 +169,9 @@ pub(crate) const GAMUT_CELLS: usize = 16; pub(crate) type GamutGrid = [u16; GAMUT_CELLS]; /// The out-of-gamut cells of the box of channel `ch` at strip value `z` through `cms`, each tested -/// at its center by the out-of-gamut warning's test ([`Cms::out_of_gamut`]) on the color a pick -/// there stores in the working RGB space. The wheel's square is the box of [`Channel::Hue`] at the -/// ring's hue. +/// at its center by the out-of-gamut warning's test ([`Cms::out_of_gamut`]) on the working-RGB color +/// of a pick there, before [`stored`] converts it to CMYK or Lab. The wheel's square is the box of +/// [`Channel::Hue`] at the ring's hue. pub(crate) fn gamut_grid(cms: &Cms, ch: Channel, z: f32) -> GamutGrid { let n = GAMUT_CELLS as f32; let mut grid = [0; GAMUT_CELLS]; diff --git a/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs index 0573b5a37f..fa1bde439d 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs @@ -107,11 +107,18 @@ fn the_cache_computes_once_per_key() { fn the_grid_is_computed_again_after_a_profile_is_loaded() { let mut h = harness(app("#3366cc", "box", true)); let Some((before, _)) = drawn(&h) else { panic!("the box drew no grid") }; + /// Unregisters the profile when dropped, also after a failed assertion. + struct Unregister(&'static str); + impl Drop for Unregister { + fn drop(&mut self) { + cms::unregister_icc(self.0); + } + } let name = "Color Wheel Gamut Reload CMYK"; let bytes = cms::icc_bytes(cms::GENERIC_CMYK).unwrap(); + let _unregister = Unregister(name); cms::register_icc(&bytes, Some(name.into())).unwrap(); h.run_steps(2); - cms::unregister_icc(name); let Some((after, _)) = drawn(&h) else { panic!("the box drew no grid") }; assert_eq!((after.0, after.1, &after.2), (before.0, before.1, &before.2)); assert!(after.3 > before.3, "the key follows the loaded profiles: {} then {}", before.3, after.3); diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 278ae0282e..da1bffd97b 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -734,8 +734,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, the box's channel and the out-of-gamut shading (`ui.colorWheel`, - /// [`crate::panels::color_wheel::deserialize_settings`]). + /// Color Wheel panel: the wheel or the box, the box's channel and the out-of-gamut shading + /// (`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 From ca54bdf9fc384c1ece30c87eb035b36e70f8fc97 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 09:35:54 -0800 Subject: [PATCH 3/5] Color Wheel: a test for the gray over out-of-gamut cells - A new test paints a two-by-two grid and checks that the gray covers the marked cells only and that each edge is drawn dark, then light. - The "Show Out-of-Gamut Colors" catalog row moves to right after "Box View", next to the panel's other menu items, in every catalog. - The gamut_grid doc comment says that a pick's color is tested before any conversion to CMYK or Lab, which happens only for some targets. - The test profile's guard is created after the profile registers. --- crates/ui-egui/src/i18n/bg.tsv | 2 +- crates/ui-egui/src/i18n/bs.tsv | 2 +- crates/ui-egui/src/i18n/ca.tsv | 2 +- crates/ui-egui/src/i18n/cs.tsv | 2 +- crates/ui-egui/src/i18n/da.tsv | 2 +- crates/ui-egui/src/i18n/de.tsv | 2 +- crates/ui-egui/src/i18n/el.tsv | 2 +- crates/ui-egui/src/i18n/es.tsv | 2 +- crates/ui-egui/src/i18n/fi.tsv | 2 +- crates/ui-egui/src/i18n/fr.tsv | 2 +- crates/ui-egui/src/i18n/gu.tsv | 2 +- crates/ui-egui/src/i18n/hi.tsv | 2 +- crates/ui-egui/src/i18n/hu.tsv | 2 +- crates/ui-egui/src/i18n/id.tsv | 2 +- crates/ui-egui/src/i18n/it.tsv | 2 +- crates/ui-egui/src/i18n/ja.tsv | 2 +- crates/ui-egui/src/i18n/ka.tsv | 2 +- crates/ui-egui/src/i18n/ko.tsv | 2 +- crates/ui-egui/src/i18n/nl.tsv | 2 +- crates/ui-egui/src/i18n/pl.tsv | 2 +- crates/ui-egui/src/i18n/pt-br.tsv | 2 +- crates/ui-egui/src/i18n/ru.tsv | 2 +- crates/ui-egui/src/i18n/sv.tsv | 2 +- crates/ui-egui/src/i18n/tr.tsv | 2 +- crates/ui-egui/src/i18n/uk.tsv | 2 +- crates/ui-egui/src/i18n/vi.tsv | 2 +- crates/ui-egui/src/i18n/zh-hans.tsv | 2 +- crates/ui-egui/src/i18n/zh-hant.tsv | 2 +- crates/ui-egui/src/panels/color_wheel.rs | 6 ++-- .../src/panels/tests_color_wheel_gamut.rs | 33 ++++++++++++++++++- crates/ui-egui/src/widgets.rs | 4 +-- crates/ui-egui/src/widgets/color.rs | 4 +-- 32 files changed, 67 insertions(+), 36 deletions(-) diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 36488e4c37..127187a417 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -559,10 +559,10 @@ font-technology Variable Променливи {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Изглед „Колело“ Box View Изглед „Квадрат“ + Show Out-of-Gamut Colors Показване на цветовете извън цветовата гама Box Channel Канал на квадрата Color box Цветови квадрат Color Wheel Options Опции на цветното колело - Show Out-of-Gamut Colors Показване на цветовете извън цветовата гама Color Type: Цветен тип: Color: Цвят: Colorize Оцветяване diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index eee2cb2b4d..e5c68dc192 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -737,10 +737,10 @@ {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Prikaz kotača Box View Prikaz kvadrata + Show Out-of-Gamut Colors Prikaži boje izvan gamuta Box Channel Kanal kvadrata Color box Kvadrat boje Color Wheel Options Opcije kotača boja - Show Out-of-Gamut Colors Prikaži boje izvan gamuta 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 6f7a5b84fa..319406b2d2 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -821,10 +821,10 @@ antiAlias Sharp Nítid {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Visualització de roda Box View Visualització de quadre + Show Out-of-Gamut Colors Mostra els colors fora de gama Box Channel Canal del quadre Color box Quadre de color Color Wheel Options Opcions de la roda de colors - Show Out-of-Gamut Colors Mostra els colors fora de gama 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 aec29f9ab7..755dae9cba 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -750,10 +750,10 @@ {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Zobrazení kola Box View Zobrazení čtverce + Show Out-of-Gamut Colors Zobrazit barvy mimo gamut Box Channel Kanál čtverce Color box Barevný čtverec Color Wheel Options Možnosti barevného kola - Show Out-of-Gamut Colors Zobrazit barvy mimo gamut 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 ca095adf83..1508d851ff 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -695,10 +695,10 @@ {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Hjulvisning Box View Kvadratvisning + Show Out-of-Gamut Colors Vis farver uden for gamut Box Channel Kvadratets kanal Color box Farvekvadrat Color Wheel Options Indstillinger for farvehjul - Show Out-of-Gamut Colors Vis farver uden for gamut 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 2ce633fe27..5e76cccc62 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -552,10 +552,10 @@ font-technology Variable Variabel {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Kreisansicht Box View Quadratansicht + Show Out-of-Gamut Colors Farben außerhalb des Farbumfangs einblenden Box Channel Kanal des Quadrats Color box Farbquadrat Color Wheel Options Optionen für den Farbkreis - Show Out-of-Gamut Colors Farben außerhalb des Farbumfangs einblenden 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 e69fb91d61..54b59e3528 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -534,10 +534,10 @@ font-technology Variable Μεταβλητές {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Προβολή τροχού Box View Προβολή τετραγώνου + Show Out-of-Gamut Colors Εμφάνιση χρωμάτων εκτός χρωματικής γκάμας Box Channel Κανάλι τετραγώνου Color box Τετράγωνο χρώματος Color Wheel Options Επιλογές χρωματικού τροχού - Show Out-of-Gamut Colors Εμφάνιση χρωμάτων εκτός χρωματικής γκάμας Color Type: Τύπος χρώματος: Color: Χρώμα: Colorize Χρωματισμός diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 2e3db2a871..b0802db4fd 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -574,10 +574,10 @@ font-technology Variable Variables {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Vista de rueda Box View Vista de cuadro + Show Out-of-Gamut Colors Mostrar colores fuera de gama Box Channel Canal del cuadro Color box Cuadro de color Color Wheel Options Opciones de la rueda de color - Show Out-of-Gamut Colors Mostrar colores fuera de gama 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 b94e5bef08..ba2f7738bb 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -741,10 +741,10 @@ {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Ympyränäkymä Box View Ruutunäkymä + Show Out-of-Gamut Colors Näytä väriavaruuden ulkopuoliset värit Box Channel Ruudun kanava Color box Väriruutu Color Wheel Options Väriympyrän asetukset - Show Out-of-Gamut Colors Näytä väriavaruuden ulkopuoliset värit 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 98451403b1..e5b16e9840 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -575,10 +575,10 @@ font-technology Variable Variables {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Affichage roue Box View Affichage carré + Show Out-of-Gamut Colors Afficher les couleurs hors gamme Box Channel Couche du carré Color box Carré de couleur Color Wheel Options Options de la roue chromatique - Show Out-of-Gamut Colors Afficher les couleurs hors gamme 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 091ee4b820..f80447ab98 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -4226,10 +4226,10 @@ {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View વ્હીલ વ્યૂ Box View બૉક્સ વ્યૂ + Show Out-of-Gamut Colors ગેમટ બહારના રંગો બતાવો Box Channel બૉક્સ ચેનલ Color box રંગ બૉક્સ Color Wheel Options રંગ વ્હીલ વિકલ્પો - Show Out-of-Gamut Colors ગેમટ બહારના રંગો બતાવો {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 008c4026dd..06fc045228 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -945,10 +945,10 @@ antiAlias Sharp शार्प {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View व्हील व्यू Box View बॉक्स व्यू + Show Out-of-Gamut Colors गैमट से बाहर के रंग दिखाएँ Box Channel बॉक्स चैनल Color box कलर बॉक्स Color Wheel Options कलर व्हील ऑप्शन्स - Show Out-of-Gamut Colors गैमट से बाहर के रंग दिखाएँ Color Type: रंग का प्रकार: Color wheel कलर व्हील Color: रंग: diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 5dba6b02aa..25eea00278 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -750,10 +750,10 @@ font-technology Variable Változó {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Körnézet Box View Négyzetnézet + Show Out-of-Gamut Colors Színtartományon kívüli színek megjelenítése Box Channel Négyzet csatornája Color box Színnégyzet Color Wheel Options Színkör beállításai - Show Out-of-Gamut Colors Színtartományon kívüli színek megjelenítése 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 e91af7ace4..1ddef096bc 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -695,10 +695,10 @@ {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Tampilan roda Box View Tampilan kotak + Show Out-of-Gamut Colors Tampilkan warna di luar gamut Box Channel Saluran kotak Color box Kotak warna Color Wheel Options Opsi roda warna - Show Out-of-Gamut Colors Tampilkan warna di luar gamut 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 27c45f98e5..71a9e7669a 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -574,10 +574,10 @@ font-technology Variable Variabili {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Vista ruota Box View Vista riquadro + Show Out-of-Gamut Colors Mostra colori fuori gamma Box Channel Canale del riquadro Color box Riquadro colore Color Wheel Options Opzioni ruota dei colori - Show Out-of-Gamut Colors Mostra colori fuori gamma 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 ab10f2a379..70bc0e1c57 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -765,10 +765,10 @@ digits Malayalam マラヤーラム数字 {name1} {value1}, {name2} {value2} {name1} {value1}、{name2} {value2} Wheel View ホイール表示 Box View ボックス表示 + Show Out-of-Gamut Colors 色域外のカラーを表示 Box Channel ボックスのチャンネル Color box カラーボックス Color Wheel Options カラーホイールオプション - Show Out-of-Gamut Colors 色域外のカラーを表示 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 6a9a3019a3..5221b80bfe 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -661,10 +661,10 @@ {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View წრის ხედი Box View კვადრატის ხედი + Show Out-of-Gamut Colors ფერთა გამის გარეთ მყოფი ფერების ჩვენება Box Channel კვადრატის არხი Color box ფერის კვადრატი Color Wheel Options ფერთა წრის პარამეტრები - Show Out-of-Gamut Colors ფერთა გამის გარეთ მყოფი ფერების ჩვენება 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 097412b714..95a99412a2 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -758,10 +758,10 @@ digits Malayalam 말라얄람어 {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View 휠 보기 Box View 상자 보기 + Show Out-of-Gamut Colors 색상 범위를 벗어난 색상 표시 Box Channel 상자 채널 Color box 색상 상자 Color Wheel Options 색상환 옵션 - Show Out-of-Gamut Colors 색상 범위를 벗어난 색상 표시 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 0161a073f8..87b7fe0928 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1213,10 +1213,10 @@ {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Wielweergave Box View Vakweergave + Show Out-of-Gamut Colors Kleuren buiten gamut tonen Box Channel Kanaal van het vak Color box Kleurvak Color Wheel Options Opties voor kleurenwiel - Show Out-of-Gamut Colors Kleuren buiten gamut tonen 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 f2aa40a565..752fff4f16 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -699,10 +699,10 @@ {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Widok koła Box View Widok kwadratu + Show Out-of-Gamut Colors Pokaż kolory poza gamutem Box Channel Kanał kwadratu Color box Kwadrat koloru Color Wheel Options Opcje koła kolorów - Show Out-of-Gamut Colors Pokaż kolory poza gamutem 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 c08a266e9f..0765eb04b0 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -519,10 +519,10 @@ antiAlias Sharp Nítido {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Exibição em Roda Box View Exibição em Caixa + Show Out-of-Gamut Colors Mostrar Cores Fora do Gamut Box Channel Canal da Caixa Color box Caixa de cor Color Wheel Options Opções da Roda de Cores - Show Out-of-Gamut Colors Mostrar Cores Fora do Gamut 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 3bd0a834c1..7f5b8bd375 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -572,10 +572,10 @@ font-technology Variable Вариативные {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Вид «Круг» Box View Вид «Квадрат» + Show Out-of-Gamut Colors Показать цвета вне цветового охвата Box Channel Канал квадрата Color box Цветовой квадрат Color Wheel Options Параметры цветового круга - Show Out-of-Gamut Colors Показать цвета вне цветового охвата Color Type: Тип цвета: Color: Цвет: Colorize Тонировать diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 8e7fbfe533..26b5f6be86 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -561,10 +561,10 @@ font-technology Variable Variabla {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Hjulvy Box View Rutvy + Show Out-of-Gamut Colors Visa färger utanför färgomfånget Box Channel Rutans kanal Color box Färgruta Color Wheel Options Alternativ för färghjulet - Show Out-of-Gamut Colors Visa färger utanför färgomfånget 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 eafcee0d19..0f6ffc23df 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -555,10 +555,10 @@ font-technology Variable Değişken {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Tekerlek Görünümü Box View Kutu Görünümü + Show Out-of-Gamut Colors Gamut Dışı Renkleri Göster Box Channel Kutu Kanalı Color box Renk kutusu Color Wheel Options Renk Tekerleği Seçenekleri - Show Out-of-Gamut Colors Gamut Dışı Renkleri Göster 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 760b927ada..a2048a6dc5 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -568,10 +568,10 @@ font-technology Variable Варіативні {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Вигляд «Коло» Box View Вигляд «Квадрат» + Show Out-of-Gamut Colors Показати кольори поза колірним охопленням Box Channel Канал квадрата Color box Колірний квадрат Color Wheel Options Параметри колірного кола - Show Out-of-Gamut Colors Показати кольори поза колірним охопленням Color Type: Тип кольору: Color: Колір: Colorize Тонувати diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index bb25880b0a..665a1b3e37 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -661,10 +661,10 @@ font-technology Variable Biến thiên {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} Wheel View Hiển thị bánh xe Box View Hiển thị hộp + Show Out-of-Gamut Colors Hiện màu ngoài dải màu 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 Out-of-Gamut Colors Hiện màu ngoài dải màu 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 305599550d..dff948e79b 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -520,10 +520,10 @@ antiAlias Sharp 锐利 {name1} {value1}, {name2} {value2} {name1} {value1},{name2} {value2} Wheel View 色轮视图 Box View 方块视图 + Show Out-of-Gamut Colors 显示超出色域的颜色 Box Channel 方块色版 Color box 颜色方块 Color Wheel Options 色轮选项 - Show Out-of-Gamut Colors 显示超出色域的颜色 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 3144392377..99e651243c 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -537,10 +537,10 @@ font-technology Variable 可變 {name1} {value1}, {name2} {value2} {name1} {value1},{name2} {value2} Wheel View 色輪檢視 Box View 方塊檢視 + Show Out-of-Gamut Colors 顯示超出色域的顏色 Box Channel 方塊色版 Color box 顏色方塊 Color Wheel Options 色輪選項 - Show Out-of-Gamut Colors 顯示超出色域的顏色 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 14cc4ebab1..64c75fa5aa 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -169,9 +169,9 @@ pub(crate) const GAMUT_CELLS: usize = 16; pub(crate) type GamutGrid = [u16; GAMUT_CELLS]; /// The out-of-gamut cells of the box of channel `ch` at strip value `z` through `cms`, each tested -/// at its center by the out-of-gamut warning's test ([`Cms::out_of_gamut`]) on the working-RGB color -/// of a pick there, before [`stored`] converts it to CMYK or Lab. The wheel's square is the box of -/// [`Channel::Hue`] at the ring's hue. +/// at its center by the out-of-gamut warning's test ([`Cms::out_of_gamut`]) on the working-RGB +/// color of a pick there, before any conversion to CMYK or Lab in [`stored`]. The wheel's square is +/// the box of [`Channel::Hue`] at the ring's hue. pub(crate) fn gamut_grid(cms: &Cms, ch: Channel, z: f32) -> GamutGrid { let n = GAMUT_CELLS as f32; let mut grid = [0; GAMUT_CELLS]; diff --git a/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs index fa1bde439d..f24329b69d 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs @@ -116,8 +116,8 @@ fn the_grid_is_computed_again_after_a_profile_is_loaded() { } let name = "Color Wheel Gamut Reload CMYK"; let bytes = cms::icc_bytes(cms::GENERIC_CMYK).unwrap(); - let _unregister = Unregister(name); cms::register_icc(&bytes, Some(name.into())).unwrap(); + let _unregister = Unregister(name); h.run_steps(2); let Some((after, _)) = drawn(&h) else { panic!("the box drew no grid") }; assert_eq!((after.0, after.1, &after.2), (before.0, before.1, &before.2)); @@ -221,3 +221,34 @@ fn the_edge_runs_between_marked_and_unmarked_cells() { assert_eq!(crate::widgets::shade_edges(&[0b100]), Vec::<[(usize, usize); 2]>::new(), "bit 2 is past a 1 × 1 grid"); assert_eq!(crate::widgets::shade_edges(&[]), Vec::<[(usize, usize); 2]>::new()); } + +/// The gray covers each marked cell and no other, and each edge is drawn dark, then light on top. +#[test] +fn the_gray_covers_the_marked_cells_only() { + use egui::{Pos2, Rect, Shape}; + let ctx = egui::Context::default(); + let rect = Rect::from_min_size(Pos2::new(10.0, 20.0), vec2(16.0, 16.0)); + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| crate::widgets::shade_cells(ui.painter(), rect, &[0b01, 0b10])); + out.textures_delta.clear(); + let grays: Vec = out + .shapes + .iter() + .filter_map(|c| match &c.shape { + Shape::Rect(r) if r.fill == crate::widgets::SHADE => Some(r.rect), + _ => None, + }) + .collect(); + let cell = |col: f32, row: f32| Rect::from_min_size(Pos2::new(10.0 + col * 8.0, 20.0 + row * 8.0), vec2(8.0, 8.0)); + assert_eq!(grays, vec![cell(0.0, 0.0), cell(1.0, 1.0)]); + let lines: Vec<(f32, egui::Color32)> = out + .shapes + .iter() + .filter_map(|c| match &c.shape { + Shape::LineSegment { stroke, .. } => Some((stroke.width, stroke.color)), + _ => None, + }) + .collect(); + let dark = vec![(2.0, egui::Color32::BLACK); 4]; + let light = vec![(1.0, egui::Color32::WHITE); 4]; + assert_eq!(lines, [dark, light].concat(), "four edges, dark under light"); +} diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 1c36c9fc1a..9625774112 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -34,14 +34,14 @@ pub(crate) use buttons::{button_width, icon_button_info, primary_button_width, s #[cfg(test)] 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}; -#[cfg(test)] -pub(crate) use color::shade_edges; pub use color::{ FieldAxis, Live, RingResponse, SliderValue, WheelResponse, channel_slider, channel_slider_named, channel_slider_stepped, channel_slider_valued, color_field, color_field_shaded, 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, }; pub(crate) use color::{HEX_FIELD_CHARS, hex_text, pointer_phase}; +#[cfg(test)] +pub(crate) use color::{SHADE, shade_cells, shade_edges}; pub use drag::{ PanelDrag, RowClick, SwatchRows, apply_row_click, art_drop, doc_preview, drag_ghost, drag_source, drop_target_outline, ghost_row, row_click, }; diff --git a/crates/ui-egui/src/widgets/color.rs b/crates/ui-egui/src/widgets/color.rs index 21ddb3fb85..d2c1ce311d 100644 --- a/crates/ui-egui/src/widgets/color.rs +++ b/crates/ui-egui/src/widgets/color.rs @@ -463,7 +463,7 @@ pub fn color_field_shaded( } /// The gray over a shaded cell of a [`color_field_shaded`]. -const SHADE: Color32 = Color32::from_rgba_premultiplied(96, 96, 96, 192); +pub(crate) const SHADE: Color32 = Color32::from_rgba_premultiplied(96, 96, 96, 192); /// Whether cell `col` of row `row` of `shade` is marked; a cell outside the grid is not. fn shaded(shade: &[u16], col: usize, row: usize) -> bool { @@ -491,7 +491,7 @@ pub(crate) fn shade_edges(shade: &[u16]) -> Vec<[(usize, usize); 2]> { /// Gray out the cells `shade` marks over `rect`, and draw the lines between them and the others /// dark under light. -fn shade_cells(painter: &egui::Painter, rect: Rect, shade: &[u16]) { +pub(crate) fn shade_cells(painter: &egui::Painter, rect: Rect, shade: &[u16]) { let n = shade.len().min(16); if n == 0 { return; From 70885f54668ca71bd8dd4781bfe674e405b1a22e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 22:57:51 -0800 Subject: [PATCH 4/5] Color Wheel: document null params and the sampled gamut shading ui.colorWheel's params text and docs/mcp.md now say that a key set to null keeps its value while the other keys apply, and that the out-of-gamut shading is approximate: each cell of the 16 by 16 grid is grayed out or not by the color at its center. A test checks that null keeps view and channel while another key applies. --- crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/panels/color_wheel.rs | 5 +++-- crates/ui-egui/src/panels/tests_color_wheel_gamut.rs | 8 ++++++-- docs/mcp.md | 7 +++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index aa8a0f8cbf..dc8fbefef8 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1418,7 +1418,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.colorWheel", "Color Wheel Options", "", - "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, gamut?: 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); gamut true grays out the parts of the wheel's square and the box's field whose colors the CMYK space cannot print (the out-of-gamut warning's test, as color.gamutCheck answers it), as Show Out-of-Gamut Colors does, and false shows them again; 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 three 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, gamut}", + "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, gamut?: 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); gamut true grays out the parts of the wheel's square and the box's field whose colors the CMYK space cannot print (the out-of-gamut warning's test, as color.gamutCheck answers it), as Show Out-of-Gamut Colors does, and false shows them again; the shading is approximate: each cell of a 16 by 16 grid over the square or the field is grayed out or not by the color at its center, so a grayed cell can hold printable colors and a clear cell can hold colors that cannot print; keys left out or set to null keep their values while the other keys apply, params that are not an object, another key or a value off the list are an error and change nothing, all three 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, gamut}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 1b9165108c..9648962555 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1419,7 +1419,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.colorWheel", "Color Wheel Options", "", - "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, gamut?: 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); gamut true grays out the parts of the wheel's square and the box's field whose colors the CMYK space cannot print (the out-of-gamut warning's test, as color.gamutCheck answers it), as Show Out-of-Gamut Colors does, and false shows them again; 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 three 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, gamut}", + "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, gamut?: 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); gamut true grays out the parts of the wheel's square and the box's field whose colors the CMYK space cannot print (the out-of-gamut warning's test, as color.gamutCheck answers it), as Show Out-of-Gamut Colors does, and false shows them again; the shading is approximate: each cell of a 16 by 16 grid over the square or the field is grayed out or not by the color at its center, so a grayed cell can hold printable colors and a clear cell can hold colors that cannot print; keys left out or set to null keep their values while the other keys apply, params that are not an object, another key or a value off the list are an error and change nothing, all three 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, gamut}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/panels/color_wheel.rs b/crates/ui-egui/src/panels/color_wheel.rs index 64c75fa5aa..6009ba5963 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -104,8 +104,9 @@ pub fn deserialize_settings<'de, D: serde::Deserializer<'de>>(d: D) -> Result Result { const KEYS: [&str; 3] = ["view", "channel", "gamut"]; match p { diff --git a/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs index f24329b69d..b124ab492b 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs @@ -150,8 +150,9 @@ fn with_the_setting_off_no_grid_is_computed() { assert_eq!(drawn(&h), None); } -/// `ui.colorWheel {gamut}` sets the setting and keeps the others; a value that is not true or -/// false is an error that changes nothing, translated where messages are. +/// `ui.colorWheel {gamut}` sets the setting and keeps the others; a key set to null keeps its value +/// while the other keys apply; a value that is not true or false is an error that changes nothing, +/// translated where messages are. #[test] fn ui_color_wheel_sets_gamut() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); @@ -161,6 +162,9 @@ fn ui_color_wheel_sets_gamut() { assert_eq!(e, "`gamut` must be true or false"); assert_eq!(app.ui.color_wheel, Settings { view: View::Box, gamut: true, ..Default::default() }, "an error changes nothing"); assert_eq!(app.run("ui.colorWheel", json!({"gamut": null})).unwrap()["gamut"], json!(true), "null keeps the value"); + app.run("ui.colorWheel", json!({"channel": "red"})).unwrap(); + let got = app.run("ui.colorWheel", json!({"view": "wheel", "channel": null, "gamut": null})).unwrap(); + assert_eq!(got, json!({"view": "wheel", "channel": "red", "gamut": true}), "null keeps a value while the other keys apply"); assert_eq!(app.run("ui.colorWheel", json!({"gamut": false})).unwrap()["gamut"], json!(false)); for code in ["de", "fr", "ja", "zh-hans"] { let lang = crate::i18n::Lang::from_code(code).expect("registered"); diff --git a/docs/mcp.md b/docs/mcp.md index 1f11853929..2af8195eee 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -674,8 +674,11 @@ and answers true when the fields show in percent. 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. `"gamut": true` grays out the parts of the wheel's square and the box's field whose colors the CMYK space cannot print, as the panel menu's Show Out-of-Gamut Colors does, and `false` shows them again. The -test is the out-of-gamut warning's, which `color.gamutCheck` answers for one color. 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 +test is the out-of-gamut warning's, which `color.gamutCheck` answers for one color. The shading is approximate: the +panel tests the color at the center of each cell of a 16 by 16 grid over the square or the field and grays out the +whole cell or none of it, so a grayed cell can hold printable colors and a clear cell can hold colors that cannot +print. Keys left out or set to `null` keep their values, and the other keys still apply. 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, gamut}`, and the settings are kept with the preferences. In remote desktop mode, `invoke_menu` with `{"command":"ui.sampleScreenColor","params":{}}` shows the system's From 993ad1cd55d1df398465efa7a373bdce76baa499 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:26:22 -0800 Subject: [PATCH 5/5] Color Wheel: test that a null view keeps the view ui_color_wheel_sets_gamut now also runs ui.colorWheel with view set to null and gamut set to false, and checks that the view stays as it was while gamut applies. --- crates/ui-egui/src/panels/tests_color_wheel_gamut.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs index b124ab492b..47a68fad76 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs @@ -165,7 +165,8 @@ fn ui_color_wheel_sets_gamut() { app.run("ui.colorWheel", json!({"channel": "red"})).unwrap(); let got = app.run("ui.colorWheel", json!({"view": "wheel", "channel": null, "gamut": null})).unwrap(); assert_eq!(got, json!({"view": "wheel", "channel": "red", "gamut": true}), "null keeps a value while the other keys apply"); - assert_eq!(app.run("ui.colorWheel", json!({"gamut": false})).unwrap()["gamut"], json!(false)); + let got = app.run("ui.colorWheel", json!({"view": null, "gamut": false})).unwrap(); + assert_eq!(got, json!({"view": "wheel", "channel": "red", "gamut": false}), "a null view keeps the view while gamut applies"); for code in ["de", "fr", "ja", "zh-hans"] { let lang = crate::i18n::Lang::from_code(code).expect("registered"); let shown = crate::i18n::message(lang, &e);