From d3375c165602e27593fe2376e3c9b4ee470ad6bb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 12 Nov 2026 16:04:30 -0800 Subject: [PATCH] Color: Toggle RGB Percent switches the RGB units from the keyboard The double-click right of an RGB field was the only way to switch R, G and B between percent and 0 to 255 from the UI. ui.colorRgbPercent (Toggle RGB Percent) is listed in the command palette and in Keyboard Shortcuts without a default key, and switches the same setting. A parameter answers an error and changes nothing. The label has a row in every complete catalog. --- crates/mcp/src/ui_catalog.rs | 6 +++++ 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/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/run.rs | 1 + crates/ui-egui/src/menus/ui_commands.rs | 6 +++++ crates/ui-egui/src/panels/color.rs | 27 ++++++++++++++++++--- crates/ui-egui/src/panels/color/tests.rs | 31 ++++++++++++++++++++++++ docs/control-protocol.md | 4 ++- docs/mcp.md | 2 ++ docs/target-app-parity.md | 2 +- 35 files changed, 101 insertions(+), 5 deletions(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 044d4b0098..5c137347c0 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1244,6 +1244,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{mode?: grayscale|rgb|hsb|cmyk|websafe, options?: bool, recentColors?: bool, rgbPercent?: bool} pick the Color panel's mode as its panel menu does (the active color converts to the mode's model as one undo step), Show Options (true) or Hide Options (false), check (true) or uncheck (false) Show Recent Colors, which shows or hides the panel's Recent Colors row (applied colors still join the list while it is hidden; the Swatches panel keeps its row), and show the RGB mode's R, G and B in percent (true) or from 0 to 255 (false), as a double-click right of an RGB field switches them (the color does not change; Web Safe RGB and the hex field stay in 0 to 255); all four are kept with the preferences; RGB, HSB, Web Safe RGB and hex values use the working RGB space (ui.inspect: ui.color_mode, ui.color_hide_options, ui.color_show_recent_colors, ui.color_rgb_percent) → {mode (null: none picked yet), options, recentColors, rgbPercent, shown: the mode the panel shows the color in, or tint for a tint of a global or spot swatch}", ), + ( + "ui.colorRgbPercent", + "Toggle RGB Percent", + "", + "{} switch the Color panel's R, G and B between percent and 0 to 255, as a double-click right of an RGB field does (ui.colorPanel {rgbPercent}); the color does not change, and the choice is kept with the preferences; a parameter is an error and changes nothing → true when they show in percent", + ), ( "ui.savePdfDialog", "Save PDF Dialog", diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 582a927f09..59a90fb3eb 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -3209,6 +3209,7 @@ digits Malayalam Малаялам Show Note Показване на бележка Show Options Показване на опциите Show Recent Colors Показване на скорошните цветове + Toggle RGB Percent Превключване на RGB в проценти Show Original Path Показване на оригиналния път Open this dialog with these settings next time Отваряне на този прозорец с тези настройки следващия път Auto-Simplify Автоматично опростяване diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index d92da7ae40..12b0b4296f 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -1577,6 +1577,7 @@ digits Malayalam Malajalam Select a text object to edit its character attributes. Odaberite tekstualni objekat da uredite njegove atribute znakova. Show Options Prikaži opcije Show Recent Colors Prikaži nedavne boje + Toggle RGB Percent Uključi/isključi RGB u postocima Color Panel Options Opcije panela boja Small Caps Mala velika slova Small Caps (on the roadmap) Mala velika slova (u planu) diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 283dae1800..ec47856891 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -4172,6 +4172,7 @@ digits Malayalam Malaiàlam Show Note Mostra la nota Show Options Mostra les opcions Show Recent Colors Mostra els colors recents + Toggle RGB Percent Commuta RGB en percentatge Show Original Path Mostra el traçat original Show Package Mostra el paquet Show Panel Mostra el panell diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 519963c4eb..66a150193f 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -1606,6 +1606,7 @@ digits Malayalam Malajálamské Select a text object to edit its character attributes. Vyberte textový objekt, abyste mohli upravit atributy jeho znaků. Show Options Zobrazit možnosti Show Recent Colors Zobrazit nedávné barvy + Toggle RGB Percent Přepnout RGB v procentech Color Panel Options Možnosti panelu Barva Small Caps Kapitálky Small Caps (on the roadmap) Kapitálky (v plánu) diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 3269755003..ba3d8db4ee 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -1513,6 +1513,7 @@ digits Malayalam Malayalam Select a text object to edit its character attributes. Markér et tekstobjekt for at redigere dets tegnattributter. Show Options Vis indstillinger Show Recent Colors Vis seneste farver + Toggle RGB Percent Skift RGB i procent Small Caps Kapitæler Small Caps (on the roadmap) Kapitæler (på vejkortet) Standard Vertical Roman Alignment Standard lodret romersk justering diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index f3858abc1f..fc86077d41 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3269,6 +3269,7 @@ digits Malayalam Malayalam Show Note Notiz einblenden Show Options Optionen einblenden Show Recent Colors Zuletzt verwendete Farben einblenden + Toggle RGB Percent RGB in Prozent umschalten Show Original Path Originalpfad einblenden Open this dialog with these settings next time Dieses Dialogfeld nächstes Mal mit diesen Einstellungen öffnen Auto-Simplify Automatisch vereinfachen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 52a12276f7..22a8fee2e8 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -3763,6 +3763,7 @@ digits Malayalam Μαλαγιάλαμ Show Note Εμφάνιση σημείωσης Show Options Εμφάνιση επιλογών Show Recent Colors Εμφάνιση πρόσφατων χρωμάτων + Toggle RGB Percent Εναλλαγή RGB σε ποσοστό Show Original Path Εμφάνιση αρχικής διαδρομής Open this dialog with these settings next time Άνοιγμα αυτού του παραθύρου με αυτές τις ρυθμίσεις την επόμενη φορά Auto-Simplify Αυτόματη απλοποίηση diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index e6f77cd908..393d090f77 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -3300,6 +3300,7 @@ digits Malayalam Malayálam Show Note Mostrar nota Show Options Mostrar opciones Show Recent Colors Mostrar colores recientes + Toggle RGB Percent Alternar RGB en porcentaje Show Original Path Mostrar trazado original Open this dialog with these settings next time Abrir este cuadro de diálogo con estos ajustes la próxima vez Auto-Simplify Simplificar automáticamente diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index dc0e432264..ffb8a912e1 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -1580,6 +1580,7 @@ digits Malayalam Malajalam Select a text object to edit its character attributes. Valitse tekstiobjekti, jonka merkkimääritteitä haluat muokata. Show Options Näytä asetukset Show Recent Colors Näytä viimeisimmät värit + Toggle RGB Percent Vaihda RGB prosentteina Small Caps Kapiteelit Small Caps (on the roadmap) Kapiteelit (suunnitteilla) Standard Vertical Roman Alignment Tavallinen pystysuuntainen latinalainen tasaus diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3c74586ef0..477b697621 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3292,6 +3292,7 @@ digits Malayalam Malayalam Show Note Afficher la note Show Options Afficher les options Show Recent Colors Afficher les couleurs récentes + Toggle RGB Percent Basculer RVB en pourcentage Show Original Path Afficher le tracé d’origine Open this dialog with these settings next time Ouvrir cette boîte de dialogue avec ces réglages la prochaine fois Auto-Simplify Simplifier automatiquement diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 8e1ce7cc2a..f526921203 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -4504,6 +4504,7 @@ antiAlias Sharp शार्प Show Note नोट दिखाएं Show Options ऑप्शन्स दिखाएँ Show Recent Colors हाल के रंग दिखाएँ + Toggle RGB Percent RGB प्रतिशत में बदलें Show Original Path मूल पाथ दिखाएं Show Package पैकेज करें दिखाएँ Show Panel शो पैनल diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 15ce573c11..170c552a88 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -3934,6 +3934,7 @@ mark-style Japanese Japán Show Note Megjegyzés megjelenítése Show Options Beállítások megjelenítése Show Recent Colors Legutóbbi színek megjelenítése + Toggle RGB Percent RGB százalékos megjelenítésének váltása Show Original Path Eredeti útvonal megjelenítése Open this dialog with these settings next time Legközelebb ez a párbeszédablak nyíljon meg ezekkel a beállításokkal Auto-Simplify Automatikus egyszerűsítés diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index f68fad0c1c..7a5d653f38 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -1513,6 +1513,7 @@ digits Malayalam Malayalam Select a text object to edit its character attributes. Pilih objek teks untuk mengedit atribut karakternya. Show Options Tampilkan opsi Show Recent Colors Tampilkan warna terbaru + Toggle RGB Percent Alihkan RGB dalam persen Small Caps Kapital kecil Small Caps (on the roadmap) Kapital kecil (masih dalam roadmap) Standard Vertical Roman Alignment Perataan Romawi vertikal standar diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 480115859b..634db2ff80 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -3345,6 +3345,7 @@ digits Malayalam Malayalam Show Note Mostra nota Show Options Mostra opzioni Show Recent Colors Mostra colori recenti + Toggle RGB Percent Alterna RGB in percentuale Show Original Path Mostra tracciato originale Open this dialog with these settings next time Apri questa finestra di dialogo con queste impostazioni la prossima volta Auto-Simplify Semplifica automaticamente diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index ba3105aec0..2460a2d98d 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3165,6 +3165,7 @@ mark-style Japanese 日本式 Show Note メモを表示 Show Options オプションを表示 Show Recent Colors 最近使用したカラーを表示 + Toggle RGB Percent RGB のパーセント表示を切り替え Show Original Path 元のパスを表示 Open this dialog with these settings next time 次回はこの設定でこのダイアログを開く Auto-Simplify 自動単純化 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 83fadf726a..cd2f49a73b 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -1451,6 +1451,7 @@ digits Malayalam მალაიალამური Select a text object to edit its character attributes. სიმბოლოების ატრიბუტების რედაქტირებისთვის მონიშნეთ ტექსტური ობიექტი. Show Options პარამეტრების ჩვენება Show Recent Colors ბოლოდროინდელი ფერების ჩვენება + Toggle RGB Percent RGB-ის პროცენტებში ჩვენების გადართვა Small Caps პატარა მთავრული Small Caps (on the roadmap) პატარა მთავრული (სამომავლო გეგმაშია) Standard Vertical Roman Alignment სტანდარტული ვერტიკალური ლათინური სწორება diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index e6f7478bf3..6bf24cea1d 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3154,6 +3154,7 @@ mark-style Japanese 일본식 Show Note 메모 표시 Show Options 옵션 표시 Show Recent Colors 최근 색상 표시 + Toggle RGB Percent RGB 백분율 표시 전환 Show Original Path 원래 패스 표시 Open this dialog with these settings next time 다음에 이 설정으로 이 대화상자 열기 Auto-Simplify 자동 단순화 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 26baaa8dc5..371158cd66 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1527,6 +1527,7 @@ digits Malayalam Malayalam Select a text object to edit its character attributes. Selecteer een tekstobject om de tekenkenmerken ervan te bewerken. Show Options Opties tonen Show Recent Colors Recente kleuren tonen + Toggle RGB Percent RGB in procenten wisselen Small Caps Kleine kapitalen Small Caps (on the roadmap) Kleine kapitalen (op de roadmap) Standard Vertical Roman Alignment Standaard verticale Romeinse uitlijning diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 3637bb6f94..50d23b5cf4 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -1518,6 +1518,7 @@ digits Malayalam Malajalam Select a text object to edit its character attributes. Zaznacz obiekt tekstowy, aby edytować atrybuty znaków. Show Options Pokaż opcje Show Recent Colors Pokaż ostatnie kolory + Toggle RGB Percent Przełącz RGB w procentach Color Panel Options Opcje panelu Kolor Small Caps Kapitaliki Small Caps (on the roadmap) Kapitaliki (w planach) diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 15aa70e244..db371671a4 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2777,6 +2777,7 @@ digits Malayalam Malaiala Show Note Mostrar Nota Show Options Mostrar Opções Show Recent Colors Mostrar Cores Recentes + Toggle RGB Percent Alternar RGB em Porcentagem Show Original Path Mostrar Caminho Original Open this dialog with these settings next time Abrir este diálogo com estas configurações na próxima vez Auto-Simplify Simplificar Automaticamente diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 21f270a0fb..1e92af19e3 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3332,6 +3332,7 @@ digits Malayalam Малаялам Show Note Показать примечание Show Options Показать параметры Show Recent Colors Показать последние цвета + Toggle RGB Percent Переключить RGB в процентах Show Original Path Показать исходный контур Open this dialog with these settings next time Открывать это диалоговое окно с этими параметрами в следующий раз Auto-Simplify Автоматическое упрощение diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 7969960880..edde9f6325 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -3224,6 +3224,7 @@ digits Malayalam Malayalam Show Note Visa anteckning Show Options Visa alternativ Show Recent Colors Visa senaste färger + Toggle RGB Percent Växla RGB i procent Show Original Path Visa ursprunglig bana Open this dialog with these settings next time Öppna den här dialogrutan med de här inställningarna nästa gång Auto-Simplify Förenkla automatiskt diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 639bf692a8..b3a2847d32 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3127,6 +3127,7 @@ digits Malayalam Malayalam Show Note Notu Göster Show Options Seçenekleri Göster Show Recent Colors Son Renkleri Göster + Toggle RGB Percent RGB Yüzde Gösterimini Değiştir Show Original Path Orijinal Yolu Göster Color Panel Options Renk Paneli Seçenekleri Show Package Paketi Göster diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 2889757941..ccc02fece9 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3337,6 +3337,7 @@ digits Malayalam Малаялам Show Note Показати примітку Show Options Показати параметри Show Recent Colors Показати останні кольори + Toggle RGB Percent Переключити RGB у відсотках Show Original Path Показати початковий контур Open this dialog with these settings next time Наступного разу відкривати це діалогове вікно з цими параметрами Auto-Simplify Автоматичне спрощення diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index ca39a2cd16..fd13ef2c19 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3684,6 +3684,7 @@ mark-style Japanese Kiểu Nhật Show Note Hiện ghi chú Show Options Hiện tùy chọn Show Recent Colors Hiện màu gần đây + Toggle RGB Percent Chuyển đổi RGB theo phần trăm Show Original Path Hiện đường dẫn gốc Open this dialog with these settings next time Lần sau mở hộp thoại này với các cài đặt này Auto-Simplify Tự động đơn giản hóa diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index d4fe4ce4f3..e86d636b7f 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3165,6 +3165,7 @@ digits Malayalam 马拉雅拉姆数字 Show Note 显示注解 Show Options 显示选项 Show Recent Colors 显示最近使用的颜色 + Toggle RGB Percent 切换 RGB 百分比显示 Show Original Path 显示原始路径 Open this dialog with these settings next time 下次以这些设置打开此对话框 Auto-Simplify 自动简化 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 1a81d6d01c..b2cd4f4ab4 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4312,6 +4312,7 @@ digits Malayalam 馬來亞拉姆數字 Show Note 顯示註解 Show Options 顯示選項 Show Recent Colors 顯示最近使用的顏色 + Toggle RGB Percent 切換 RGB 百分比顯示 Show Original Path 顯示原始路徑 Open this dialog with these settings next time 下次以這些設定開啟此對話方塊 Auto-Simplify 自動簡化 diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 72e6c25acb..bf5490e4d8 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -929,6 +929,7 @@ fn run_ui_part10(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option crate::dialogs::tate_chu_yoko::open(app), "ui.colorGuideLimit" => crate::panels::color_guide::set_limit(app, p), "ui.colorPanel" => crate::panels::color::command(app, p), + "ui.colorRgbPercent" => crate::panels::color::rgb_percent_command(app, p), "ui.savePdfDialog" => crate::dialogs::open_save_pdf(app, p), "file.exportAs" if s("path").is_none() => { crate::dialogs::open_export_as(app, s("format").as_deref(), p); diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 824990d0a8..64ef022334 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1245,6 +1245,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{mode?: grayscale|rgb|hsb|cmyk|websafe, options?: bool, recentColors?: bool, rgbPercent?: bool} pick the Color panel's mode as its panel menu does (the active color converts to the mode's model as one undo step), Show Options (true) or Hide Options (false), check (true) or uncheck (false) Show Recent Colors, which shows or hides the panel's Recent Colors row (applied colors still join the list while it is hidden; the Swatches panel keeps its row), and show the RGB mode's R, G and B in percent (true) or from 0 to 255 (false), as a double-click right of an RGB field switches them (the color does not change; Web Safe RGB and the hex field stay in 0 to 255); all four are kept with the preferences; RGB, HSB, Web Safe RGB and hex values use the working RGB space (ui.inspect: ui.color_mode, ui.color_hide_options, ui.color_show_recent_colors, ui.color_rgb_percent) → {mode (null: none picked yet), options, recentColors, rgbPercent, shown: the mode the panel shows the color in, or tint for a tint of a global or spot swatch}", ), + ( + "ui.colorRgbPercent", + "Toggle RGB Percent", + "", + "{} switch the Color panel's R, G and B between percent and 0 to 255, as a double-click right of an RGB field does (ui.colorPanel {rgbPercent}); the color does not change, and the choice is kept with the preferences; a parameter is an error and changes nothing → true when they show in percent", + ), ( "ui.savePdfDialog", "Save PDF Dialog", diff --git a/crates/ui-egui/src/panels/color.rs b/crates/ui-egui/src/panels/color.rs index 4aee419bd1..a28fba02e5 100644 --- a/crates/ui-egui/src/panels/color.rs +++ b/crates/ui-egui/src/panels/color.rs @@ -17,7 +17,8 @@ //! A double-click right of an RGB field switches R, G and B between 0 to 255 and percent (the app //! keeps it between sessions too); Web Safe RGB and the hex field stay in 0 to 255. //! `ui.colorPanel` picks a mode, shows or hides the options and checks or unchecks Show Recent -//! Colors as the panel menu does, and switches RGB to percent and back. +//! Colors as the panel menu does, and switches RGB to percent and back. `ui.colorRgbPercent` +//! switches RGB between percent and 0 to 255 from the command palette or a keyboard shortcut. use egui::{Color32, Rect, Sense, Stroke, StrokeKind, Ui, vec2}; use serde_json::{Value, json}; @@ -584,6 +585,27 @@ pub(crate) fn command(app: &mut VectorcraftApp, p: &Value) -> Result Result { + match p { + Value::Null => {} + Value::Object(o) => { + if let Some(key) = o.keys().next() { + return Err(format!("unknown parameter `{key}`; the command takes no parameters")); + } + } + got => return Err(format!("the params must be an object, not {got}")), + } + Ok(json!(switch_rgb_units(app))) +} + +/// Switch the RGB mode's R, G and B between percent and 0 to 255, as a double-click right of an +/// RGB field does. → whether they now show in percent. +fn switch_rgb_units(app: &mut VectorcraftApp) -> bool { + app.ui.color_rgb_percent = !app.ui.color_rgb_percent; + app.ui.color_rgb_percent +} + /// Tint mode's rows: the swatch's chip and name, and the T slider and field. Returns a new tint /// (0..1) and its phase. fn tint_rows(ui: &mut Ui, tint: &Tint, slider_w: f32, field_w: f32) -> Option<(f32, Live)> { @@ -783,8 +805,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { }); }); if switch_units { - let percent = app.ui.color_rgb_percent; - command(app, &json!({ "rgbPercent": !percent })).ok(); + switch_rgb_units(app); } ui.add_space(4.0); // A clicked chip or spectrum colour: the active colour, or with Alt the inactive proxy's. diff --git a/crates/ui-egui/src/panels/color/tests.rs b/crates/ui-egui/src/panels/color/tests.rs index 4cdd50f7fc..4538a8e5ce 100644 --- a/crates/ui-egui/src/panels/color/tests.rs +++ b/crates/ui-egui/src/panels/color/tests.rs @@ -849,6 +849,37 @@ fn rgb_percent_comes_back_after_a_restart() { assert_eq!(app.run("ui.colorPanel", json!({"rgbPercent": false})).unwrap()["rgbPercent"], false); } +/// Toggle RGB Percent switches the units from the keyboard: the command palette lists it, Keyboard +/// Shortcuts takes a key for it, and each run switches R, G and B between percent and 0 to 255 as +/// the double-click does, without changing the color. +#[test] +fn toggle_rgb_percent_switches_the_units_from_the_keyboard() { + let mut app = app(); + let ctx = egui::Context::default(); + app.run("paint.setFill", json!({"color": "#336699"})).unwrap(); + app.run("ui.colorPanel", json!({"mode": "rgb"})).unwrap(); + let listed = crate::palette::items().into_iter().any(|(label, id, _)| id == "ui.colorRgbPercent" && label == "Toggle RGB Percent"); + assert!(listed, "the command palette lists it"); + let e = crate::shortcut_editor::entry("ui.colorRgbPercent").expect("listed in Keyboard Shortcuts"); + assert_eq!(e.label, "Toggle RGB Percent"); + assert_eq!(crate::shortcut_editor::default_of("ui.colorRgbPercent"), None, "no default key"); + assert_eq!(app.run("ui.colorRgbPercent", json!({})).unwrap(), json!(true)); + assert!(app.ui.color_rgb_percent); + frame(&mut app, &ctx, vec![], egui::Modifiers::NONE); + assert_eq!(app.run("ui.colorPanel", json!({})).unwrap()["rgbPercent"], true); + for p in [json!({"rgbPercent": true}), json!({"on": false})] { + let e = app.run("ui.colorRgbPercent", p.clone()).unwrap_err(); + assert!(e.ends_with("; the command takes no parameters"), "{p}: {e}"); + } + for p in [json!(false), json!([]), json!("on")] { + assert_eq!(app.run("ui.colorRgbPercent", p.clone()).unwrap_err(), format!("the params must be an object, not {p}")); + } + assert!(app.ui.color_rgb_percent, "a parameter changes nothing"); + assert_eq!(app.run("ui.colorRgbPercent", json!({})).unwrap(), json!(false)); + assert!(!app.ui.color_rgb_percent); + assert_eq!(paints_hex(&app).0, "#336699", "the color does not change"); +} + /// `ui.colorPanel {mode}` picks a mode as the panel menu does: HSB shows an RGB fill as H, S and /// B, and CMYK converts it as one undo step. #[test] diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 2288a160bd..10c8f5ab47 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -251,7 +251,9 @@ shown}`: `mode` is null until a mode is picked, and `shown` is the mode the pane tint of a global or spot swatch. Another mode, `lab` included, answers an error, as does an `options`, `recentColors` or `rgbPercent` value that is not true or false. The desktop app keeps the four settings with its preferences, and `ui.inspect` reports them as `ui.color_mode`, `ui.color_hide_options`, `ui.color_show_recent_colors` and -`ui.color_rgb_percent`. +`ui.color_rgb_percent`. `ui.colorRgbPercent {}` (Toggle RGB Percent in the command palette and Keyboard Shortcuts) +switches R, G and B between percent and 0 to 255 and answers true when they show in percent; a parameter answers an +error and changes nothing. Color Themes panel (`window.panel {panel: "colorThemes"}`): its Create tab makes a theme on a harmony wheel and its My Themes tab lists the saved themes; every action runs a command (`colorTheme.save`, `colorTheme.delete`, diff --git a/docs/mcp.md b/docs/mcp.md index 1baefe0ea3..c94732b99e 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -591,6 +591,8 @@ opens the picker through `run_command` with the remote backend. `ui.colorPanel { the panel menu's Show Recent Colors, which hides the Color panel's Recent Colors row, and `true` shows it again; applied colors still join the list while it is hidden. `ui.colorPanel {"rgbPercent": true}` shows the Color panel's RGB fields in percent, as a double-click right of an RGB field does, and `false` shows them from 0 to 255 again. +`ui.colorRgbPercent` (Toggle RGB Percent in the command palette and Keyboard Shortcuts) switches between the two +and answers true when the fields show in percent. 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 3ef2425203..56c28edcb8 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1353,7 +1353,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Unchecking Show Recent Colors in the Color panel's menu hides its Recent Colors row, and checking it shows the row again ([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)). In VectorCraft the item is checked by default and kept between sessions, applied colors still join the list while the row is hidden, Hide Options hides the row either way, and the Swatches panel keeps its row (`ui.colorPanel {recentColors}`). Tests: `show_recent_colors_hides_and_shows_the_row` in `crates/ui-egui/src/panels/color/tests.rs`. A Recent Colors chip in the Color or Swatches panel drags into the Swatches panel's list to become a swatch of its color, in its color model, as one undo step ([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)). In VectorCraft a chip dropped on a color group or one of its swatches joins that group, anywhere else in the list it joins the ungrouped swatches at the end, a color that is already a swatch is added again under another name, and dragging a chip does not paint the selected art (`swatch.new`). Tests: `a_recent_color_dragged_onto_the_list_becomes_a_swatch` and `a_recent_color_dragged_from_the_color_panel_becomes_a_swatch` in `crates/ui-egui/src/panels/swatches/tests.rs`. A Cmd/Ctrl-click on the Color panel's spectrum applies Complement and a Cmd/Ctrl+Shift-click applies Invert to the active Fill or Stroke (`paint.complement`, `paint.invert`); with Alt also held, the click recolors the inactive one, as the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) list them. - A double-click right of an RGB field switches the Color panel's R, G and B between percent and 0 to 255 ([Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), Color panel). In VectorCraft the color does not change, Web Safe RGB and the hex field stay in 0 to 255, and the panel keeps the choice between sessions (`ui.colorPanel {rgbPercent}`); the color mixer of the Fill and Stroke chips and the gradient stop dialog follow the same setting. Tests: `rgb_percent_switches_the_rgb_fields_between_percent_and_0_to_255`, `rgb_percent_does_not_switch_while_the_rows_are_disabled` and `rgb_percent_comes_back_after_a_restart` in `crates/ui-egui/src/panels/color/tests.rs`. + A double-click right of an RGB field switches the Color panel's R, G and B between percent and 0 to 255 ([Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), Color panel). In VectorCraft the color does not change, Web Safe RGB and the hex field stay in 0 to 255, and the panel keeps the choice between sessions (`ui.colorPanel {rgbPercent}`); the color mixer of the Fill and Stroke chips and the gradient stop dialog follow the same setting. Toggle RGB Percent (`ui.colorRgbPercent`) in the command palette and Keyboard Shortcuts switches the units from the keyboard. Tests: `rgb_percent_switches_the_rgb_fields_between_percent_and_0_to_255`, `rgb_percent_does_not_switch_while_the_rows_are_disabled`, `rgb_percent_comes_back_after_a_restart` and `toggle_rgb_percent_switches_the_units_from_the_keyboard` in `crates/ui-egui/src/panels/color/tests.rs`. View › Proof Setup › Color blindness – Tritanopia-type turns Proof Colors on and proofs the canvas with the tritanopia simulation of Brettel, Viénot and Mollon (1997). The Separations Preview panel's Proof Setup list offers the same target (`view.proofSetup {target: "tritanopia"}`). Grays keep their value. The Separations Preview panel's Gamut Check button reports one color outside the CMYK gamut in the singular and more in the plural, in English and in each language's plural forms (`gamut_check_status_takes_the_plural_form` in `crates/ui-egui/src/i18n/tests.rs`). - **Document Color Mode outside the layers:** File › Document Color Mode (in one undo step) and `document.open {colorMode}` also convert the colors of graph designs, graphic styles, opacity-mask art, the tile that pattern editing's Cancel puts back and the art of brushes (with a Hue Shift brush's key color); a tint of a global swatch there becomes the converted swatch's color at its tint, as in the art.