From 62b6f53533d02d3606576ef5e66af11590e84e60 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 11 Nov 2026 17:26:16 -0800 Subject: [PATCH] Color: the panel menu's Show Recent Colors shows or hides the Recent Colors row The Color panel's menu gets a checked Show Recent Colors item under Show Options / Hide Options. Unchecking it hides the panel's Recent Colors row; checking it shows the row again. Applied colors still join the list while the row is hidden, Hide Options hides the row either way, and the Swatches panel keeps its own row. The setting is on by default and is kept with the preferences (ui.color_show_recent_colors); a saved value that is not true or false reads as on. ui.colorPanel takes recentColors: bool and answers it. Docs: docs/mcp.md, docs/control-protocol.md, docs/target-app-parity.md. --- 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/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/color.rs | 45 ++++++++++--- crates/ui-egui/src/panels/color/tests.rs | 81 +++++++++++++++++++++++- crates/ui-egui/src/state.rs | 6 ++ docs/control-protocol.md | 15 +++-- docs/mcp.md | 4 +- docs/target-app-parity.md | 1 + 35 files changed, 164 insertions(+), 19 deletions(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index e15244580..4bcd8e8b4 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1194,7 +1194,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.colorPanel", "Color Panel Options", "", - "{mode?: grayscale|rgb|hsb|cmyk|websafe, options?: 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), and Show Options (true) or Hide Options (false); both 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) → {mode (null: none picked yet), options, shown: the mode the panel shows the color in, or tint for a tint of a global or spot swatch}", + "{mode?: grayscale|rgb|hsb|cmyk|websafe, options?: bool, recentColors?: 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), and 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); all three 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) → {mode (null: none picked yet), options, recentColors, shown: the mode the panel shows the color in, or tint for a tint of a global or spot swatch}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index d83b5ac3c..9fc057bdb 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -3142,6 +3142,7 @@ digits Malayalam Малаялам Show Modified Показване на променените Show Note Показване на бележка Show Options Показване на опциите + Show Recent Colors Показване на скорошните цветове 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 663e95cea..0e4843b25 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -1526,6 +1526,7 @@ digits Malayalam Malajalam Roman Baseline Latinična osnovna linija 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 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 9c60e87e0..7c7b8ec49 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -4056,6 +4056,7 @@ digits Malayalam Malaiàlam Show Modified Mostra els modificats Show Note Mostra la nota Show Options Mostra les opcions + Show Recent Colors Mostra els colors recents 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 e8f9666fa..1469596fd 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -1550,6 +1550,7 @@ digits Malayalam Malajálamské Roman Baseline Latinková účaří 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 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 31915ed6b..f369607d1 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -1462,6 +1462,7 @@ digits Malayalam Malayalam Roman Baseline Romersk grundlinje 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 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 2c5424d81..1d46354e5 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3189,6 +3189,7 @@ digits Malayalam Malayalam Show Modified Geänderte einblenden Show Note Notiz einblenden Show Options Optionen einblenden + Show Recent Colors Zuletzt verwendete Farben einblenden 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 6071ed5be..83d0a8810 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -3680,6 +3680,7 @@ digits Malayalam Μαλαγιάλαμ Show Modified Εμφάνιση τροποποιημένων Show Note Εμφάνιση σημείωσης Show Options Εμφάνιση επιλογών + Show Recent Colors Εμφάνιση πρόσφατων χρωμάτων 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 4a74e3ae3..6c49d275a 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -3228,6 +3228,7 @@ digits Malayalam Malayálam Show Modified Mostrar modificados Show Note Mostrar nota Show Options Mostrar opciones + Show Recent Colors Mostrar colores recientes 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 f2ec64f60..7b55a3109 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -1524,6 +1524,7 @@ digits Malayalam Malajalam Roman Baseline Latinalainen perusviiva 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 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 807b3363b..164551d44 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3220,6 +3220,7 @@ digits Malayalam Malayalam Show Modified Afficher les éléments modifiés Show Note Afficher la note Show Options Afficher les options + Show Recent Colors Afficher les couleurs récentes 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 572a19779..3504f3ee2 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -4379,6 +4379,7 @@ antiAlias Sharp शार्प Show Modified संशोधित दिखाएँ Show Note नोट दिखाएं Show Options ऑप्शन्स दिखाएँ + Show Recent Colors हाल के रंग दिखाएँ 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 8c2d2339b..4e72a2400 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -3855,6 +3855,7 @@ mark-style Japanese Japán Show Modified Módosultak megjelenítése 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 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 606ffae97..d50eb4127 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -1462,6 +1462,7 @@ digits Malayalam Malayalam Roman Baseline Baseline Romawi 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 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 bf4c9e7b5..c1f53ffac 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -3265,6 +3265,7 @@ digits Malayalam Malayalam Show Modified Mostra modificati Show Note Mostra nota Show Options Mostra opzioni + Show Recent Colors Mostra colori recenti 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 7a12afcad..a18a6c0b8 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3083,6 +3083,7 @@ mark-style Japanese 日本式 Show List View リスト表示 Show Note メモを表示 Show Options オプションを表示 + Show Recent Colors 最近使用したカラーを表示 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 c58480c42..99696a6a4 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -1396,6 +1396,7 @@ digits Malayalam მალაიალამური Roman Baseline ლათინური საბაზისო ხაზი Select a text object to edit its character attributes. სიმბოლოების ატრიბუტების რედაქტირებისთვის მონიშნეთ ტექსტური ობიექტი. Show Options პარამეტრების ჩვენება + Show Recent Colors ბოლოდროინდელი ფერების ჩვენება 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 39efdecf2..89da26471 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3072,6 +3072,7 @@ mark-style Japanese 일본식 Show List View 목록 보기 표시 Show Note 메모 표시 Show Options 옵션 표시 + Show Recent Colors 최근 색상 표시 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 dd1d22edc..46636ee74 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1476,6 +1476,7 @@ digits Malayalam Malayalam Roman Baseline Romeinse basislijn 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 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 dd850a3a4..5322f8eb5 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -1462,6 +1462,7 @@ digits Malayalam Malajalam Roman Baseline Linia bazowa łacińska 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 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 f67ae6cda..9dff70360 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2705,6 +2705,7 @@ digits Malayalam Malaiala Show List View Mostrar Exibição de Lista Show Note Mostrar Nota Show Options Mostrar Opções + Show Recent Colors Mostrar Cores Recentes 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 8eb542582..263a30854 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3260,6 +3260,7 @@ digits Malayalam Малаялам Show Modified Показать изменённые Show Note Показать примечание Show Options Показать параметры + Show Recent Colors Показать последние цвета 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 fb2c463de..824e6c46f 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -3152,6 +3152,7 @@ digits Malayalam Malayalam Show Modified Visa ändrade Show Note Visa anteckning Show Options Visa alternativ + Show Recent Colors Visa senaste färger 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 d45a171cc..f8390c2e5 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3056,6 +3056,7 @@ digits Malayalam Malayalam Show Modified Değiştirilenleri Göster Show Note Notu Göster Show Options Seçenekleri Göster + Show Recent Colors Son Renkleri Göster 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 acaf20b6b..8bf8e5236 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3257,6 +3257,7 @@ digits Malayalam Малаялам Show Modified Показати змінені Show Note Показати примітку Show Options Показати параметри + Show Recent Colors Показати останні кольори 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 4a2bbd5a6..4ad12f563 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3597,6 +3597,7 @@ mark-style Japanese Kiểu Nhật Show Modified Hiện đã sửa đổi Show Note Hiện ghi chú Show Options Hiện tùy chọn + Show Recent Colors Hiện màu gần đây 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 0eb7c7ebe..d51bbf066 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3093,6 +3093,7 @@ digits Malayalam 马拉雅拉姆数字 Show Modified 显示已修改 Show Note 显示注解 Show Options 显示选项 + Show Recent Colors 显示最近使用的颜色 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 084a7e770..7de5fe722 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4207,6 +4207,7 @@ digits Malayalam 馬來亞拉姆數字 Show Modified 顯示已修改 Show Note 顯示註解 Show Options 顯示選項 + Show Recent Colors 顯示最近使用的顏色 Show Original Path 顯示原始路徑 Open this dialog with these settings next time 下次以這些設定開啟此對話方塊 Auto-Simplify 自動簡化 diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index a96f13e67..186b21322 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1195,7 +1195,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.colorPanel", "Color Panel Options", "", - "{mode?: grayscale|rgb|hsb|cmyk|websafe, options?: 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), and Show Options (true) or Hide Options (false); both 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) → {mode (null: none picked yet), options, shown: the mode the panel shows the color in, or tint for a tint of a global or spot swatch}", + "{mode?: grayscale|rgb|hsb|cmyk|websafe, options?: bool, recentColors?: 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), and 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); all three 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) → {mode (null: none picked yet), options, recentColors, shown: the mode the panel shows the color in, or tint for a tint of a global or spot swatch}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/panels/color.rs b/crates/ui-egui/src/panels/color.rs index e58ca56f6..4e13f629a 100644 --- a/crates/ui-egui/src/panels/color.rs +++ b/crates/ui-egui/src/panels/color.rs @@ -12,7 +12,10 @@ //! the inactive proxy when Alt is also held; //! Shift-dragging a slider moves the others in tandem; RGB and HSB show the out-of-gamut warning; //! Hide Options leaves just the proxy and the spectrum (the app keeps it between sessions too). -//! `ui.colorPanel` picks a mode and shows or hides the options as the panel menu does. +//! Unchecking Show Recent Colors hides the Recent Colors row while applied colors still join the +//! list (the app keeps it between sessions too). +//! `ui.colorPanel` picks a mode, shows or hides the options and checks or unchecks Show Recent +//! Colors as the panel menu does. use egui::{Color32, Rect, Sense, Stroke, StrokeKind, Ui, vec2}; use serde_json::{Value, json}; @@ -287,6 +290,14 @@ pub fn deserialize_hide_options<'de, D: serde::Deserializer<'de>>(d: D) -> Resul Ok(v.as_bool().unwrap_or_default()) } +/// Serde reader for the saved Show Recent Colors ([`crate::UiState::color_show_recent_colors`]): +/// `false` hides the row and any other value shows it, so an unknown value doesn't lose the rest +/// of the preferences. +pub fn deserialize_show_recent_colors<'de, D: serde::Deserializer<'de>>(d: D) -> Result { + let v = ::deserialize(d)?; + Ok(v.as_bool().unwrap_or(true)) +} + /// The mode the panel shows `color` in: with nothing selected (the defaults for new art) the mode /// picked last, which the app keeps between sessions, else [`display_mode`]. fn shown_mode(app: &VectorcraftApp, color: Option<&Color>) -> Mode { @@ -511,16 +522,18 @@ fn recolor(app: &mut VectorcraftApp, ui: &Ui, tgt: &Target, invert: bool, behind } } -/// `ui.colorPanel {mode?, options?}`: pick a mode as the panel menu does ([`set_mode`]), and Show -/// Options (true) or Hide Options (false). → {mode, options, shown}: the mode picked last (null: -/// none yet), whether the options show, and the mode the panel shows the color in (`tint` for a -/// tint of a global or spot swatch). +/// `ui.colorPanel {mode?, options?, recentColors?}`: pick a mode as the panel menu does +/// ([`set_mode`]), Show Options (true) or Hide Options (false), and check (true) or uncheck +/// (false) Show Recent Colors. → {mode, options, recentColors, shown}: the mode picked last (null: +/// none yet), whether the options show, whether Show Recent Colors is checked, and the mode the +/// panel shows the color in (`tint` for a tint of a global or spot swatch). pub(crate) fn command(app: &mut VectorcraftApp, p: &Value) -> Result { let mode = match p.get("mode") { None | Some(Value::Null) => None, Some(v) => Some(menu_mode(v).ok_or("`mode` must be grayscale, rgb, hsb, cmyk or websafe")?), }; let options = crate::menus::opt_bool(p, "options")?; + let recent = crate::menus::opt_bool(p, "recentColors")?; let (fill, stroke) = app.session.proxy_mixed(); let mixed = if app.session.fill_active { fill } else { stroke }; if let Some(m) = mode { @@ -529,12 +542,20 @@ pub(crate) fn command(app: &mut VectorcraftApp, p: &Value) -> Result json!("tint"), None => json!(shown_mode(app, tgt.color().as_ref())), }; - Ok(json!({"mode": app.ui.color_mode, "options": !app.ui.color_hide_options, "shown": shown})) + Ok(json!({ + "mode": app.ui.color_mode, + "options": !app.ui.color_hide_options, + "recentColors": app.ui.color_show_recent_colors, + "shown": shown, + })) } /// Tint mode's rows: the swatch's chip and name, and the T slider and field. Returns a new tint @@ -626,8 +647,12 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { (Some(c), _) => components(mode, &c), (None, _) => vec![0.0; mode.labels().len()], }; - let recent = super::recent_colors_row(app, ui); - widgets::divider(ui); + // Show Recent Colors draws the Recent Colors row; the Swatches panel's row does not read it. + let mut recent = None; + if app.ui.color_show_recent_colors { + recent = super::recent_colors_row(app, ui); + widgets::divider(ui); + } // An edit of the active colour with its displayed components (`new`), or a colour clicked with // Alt held for the inactive proxy (`behind`). let mut new: Option<(Color, Live, Vec)> = None; @@ -770,6 +795,10 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { if menu_item(ui, if hidden { tl!("Show Options") } else { tl!("Hide Options") }, true, false) { command(app, &json!({ "options": hidden })).ok(); } + let recent = app.ui.color_show_recent_colors; + if menu_item(ui, tl!("Show Recent Colors"), true, recent) { + command(app, &json!({ "recentColors": !recent })).ok(); + } ui.separator(); let tgt = target(app, ui); let color = tgt.color(); diff --git a/crates/ui-egui/src/panels/color/tests.rs b/crates/ui-egui/src/panels/color/tests.rs index 9f9b3c1dd..36acc60e4 100644 --- a/crates/ui-egui/src/panels/color/tests.rs +++ b/crates/ui-egui/src/panels/color/tests.rs @@ -599,6 +599,83 @@ fn hide_options_comes_back_after_a_restart() { } } +/// The panel menu's Show Recent Colors hides the Recent Colors row and shows it again. Applied +/// colors still join the list while the row is hidden, Hide Options hides the row either way, and +/// the Swatches panel keeps its own row. +#[test] +fn show_recent_colors_hides_and_shows_the_row() { + let mut app = app(); + app.run("paint.setFill", json!({"color": "#ff0000"})).unwrap(); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let none = egui::Modifiers::NONE; + // The first recent chip's rect and the panel's height. The second frame's answer counts, since + // egui also answers for a widget the frame before drew. + let chip = |app: &mut VectorcraftApp| { + frame_with(app, &ctx, vec![], none, ("recent", 0usize)); + frame_with(app, &ctx, vec![], none, ("recent", 0usize)) + }; + let (shown, full) = chip(&mut app); + assert!(shown.is_some(), "the row shows by default"); + // The item is checked while the row shows. + click_menu_item(&mut app, &ctx, "✓ Show Recent Colors"); + assert!(!app.ui.color_show_recent_colors); + let (hidden, short) = chip(&mut app); + assert!(hidden.is_none() && short < full, "the row is hidden: {short} / {full}"); + // A color applied while the row is hidden still joins the list. + app.run("paint.setFill", json!({"color": "#00ff00"})).unwrap(); + assert_eq!(app.session.recent_colors.first().map(|c| c.to_hex()).as_deref(), Some("#00ff00")); + // The Swatches panel keeps its row (drawn in a context of its own, whose chip ids the Color + // panel's would share). + let mut swatch_chip = None; + let screen_rect = Some(Rect::from_min_size(egui::Pos2::ZERO, vec2(280.0, 700.0))); + let swatches = egui::Context::default(); + let mut out = swatches.run_ui(egui::RawInput { screen_rect, ..Default::default() }, |ui| { + crate::panels::swatches::show(&mut app, ui); + swatch_chip = swatches.read_response(ui.scope_id().with(("recent", 0usize))).map(|r| r.rect); + }); + out.textures_delta.clear(); + assert!(swatch_chip.is_some(), "the Swatches panel still draws its recent colors"); + // Show Options leaves the row hidden, and Hide Options hides it with the row checked too. + app.run("ui.colorPanel", json!({"options": false})).unwrap(); + app.run("ui.colorPanel", json!({"options": true})).unwrap(); + assert!(chip(&mut app).0.is_none(), "Show Options keeps Show Recent Colors unchecked"); + click_menu_item(&mut app, &ctx, "Show Recent Colors"); + assert!(chip(&mut app).0.is_some(), "checking the item shows the row again"); + assert_eq!(app.run("ui.colorPanel", json!({"options": false})).unwrap()["recentColors"], true); + assert!(chip(&mut app).0.is_none(), "Hide Options hides the row"); + assert!(app.ui.color_show_recent_colors, "Hide Options leaves Show Recent Colors checked"); + let r = app.run("ui.colorPanel", json!({"options": true, "recentColors": false})).unwrap(); + assert_eq!((&r["options"], &r["recentColors"]), (&json!(true), &json!(false))); + assert!(chip(&mut app).0.is_none()); + app.run("ui.colorPanel", json!({"recentColors": true})).unwrap(); + assert_eq!(chip(&mut app).1, full, "the panel is as tall as before"); +} + +/// Show Recent Colors is kept with the UI state, which the app saves with its preferences. A saved +/// state without it, or with a value that isn't true or false, reads as checked, and the rest of the +/// state still loads. A value that isn't true or false in the command answers an error and changes +/// nothing. +#[test] +fn show_recent_colors_comes_back_after_a_restart() { + let mut app = app(); + app.run("ui.colorPanel", json!({"recentColors": false})).unwrap(); + let saved: crate::UiState = serde_json::from_value(serde_json::to_value(&app.ui).unwrap()).unwrap(); + assert!(!saved.color_show_recent_colors); + assert_eq!(crate::control::inspect(&app, &egui::Context::default())["ui"]["color_show_recent_colors"], false); + let old: crate::UiState = serde_json::from_value(json!({"place_link": false})).unwrap(); + assert!(old.color_show_recent_colors, "a state saved before the setting existed shows the row"); + for v in [json!(7), json!("hide"), json!({}), Value::Null] { + let ui: crate::UiState = serde_json::from_value(json!({"color_show_recent_colors": v, "place_link": false})).unwrap(); + assert_eq!((ui.color_show_recent_colors, ui.place_link), (true, false), "{v}"); + } + for v in [json!("no"), json!(0), json!([])] { + let e = app.run("ui.colorPanel", json!({"mode": "cmyk", "options": false, "recentColors": v})).unwrap_err(); + assert_eq!(e, "`recentColors` must be true or false", "{v}"); + } + assert_eq!((app.ui.color_mode, app.ui.color_hide_options, app.ui.color_show_recent_colors), (None, false, false)); +} + /// `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] @@ -607,7 +684,7 @@ fn ui_color_panel_picks_a_mode_as_the_menu_does() { let ctx = egui::Context::default(); app.run("paint.setFill", json!({"color": "#336699"})).unwrap(); let r = app.run("ui.colorPanel", json!({"mode": "hsb"})).unwrap(); - assert_eq!(r, json!({"mode": "hsb", "options": true, "shown": "hsb"})); + assert_eq!(r, json!({"mode": "hsb", "options": true, "recentColors": true, "shown": "hsb"})); assert_eq!(slider_labels(&mut app, &ctx), ["H", "S", "B"]); assert_eq!(crate::control::inspect(&app, &ctx)["ui"]["color_mode"], "hsb"); assert_eq!(paints_hex(&app).0, "#336699", "HSB keeps the RGB color"); @@ -617,7 +694,7 @@ fn ui_color_panel_picks_a_mode_as_the_menu_does() { assert!(matches!(crate::panels::current_paints(&app).0.color(), Some(Color::Rgb { .. })), "undo restores it"); assert_eq!(paints_hex(&app).0, "#336699"); // `{}` reads the settings: CMYK stays picked, and the RGB fill shows in its own model. - assert_eq!(app.run("ui.colorPanel", json!({})).unwrap(), json!({"mode": "cmyk", "options": true, "shown": "rgb"})); + assert_eq!(app.run("ui.colorPanel", json!({})).unwrap(), json!({"mode": "cmyk", "options": true, "recentColors": true, "shown": "rgb"})); // A tint of a global swatch shows Tint mode. app.run("swatch.new", json!({"name": "Ink", "color": {"c": 0, "m": 1, "y": 0, "k": 0}, "spot": true})).unwrap(); app.run("paint.setFill", json!({"swatch": "Ink", "tint": 50})).unwrap(); diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 59553120c..7c0cde402 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -652,6 +652,11 @@ pub struct UiState { /// [`crate::panels::color::deserialize_hide_options`]). #[serde(default, deserialize_with = "crate::panels::color::deserialize_hide_options")] pub color_hide_options: bool, + /// Color panel: Show Recent Colors, which draws its Recent Colors row while the options show + /// (`ui.colorPanel`, [`crate::panels::color::deserialize_show_recent_colors`]). The list of + /// recent colors keeps filling while the row is hidden. + #[serde(default = "yes", deserialize_with = "crate::panels::color::deserialize_show_recent_colors")] + pub color_show_recent_colors: bool, /// The SVG Options chosen last (`svg` object of the export/save commands; null: never used). #[serde(default)] pub svg_options: Value, @@ -1094,6 +1099,7 @@ impl Default for UiState { align_spacing: 0.0, color_mode: None, color_hide_options: false, + color_show_recent_colors: true, svg_options: Value::Null, place_link: true, dialog_file: None, diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 04715474d..6382e8227 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -236,12 +236,15 @@ Edit or Apply Colors runs `ui.recolorDialog {colors, library?}` with the harmony recolours as usual; with nothing selected the colours themselves are the rows and `ui.dialog.confirm` saves them as a new colour group (`swatch.newGroup`, named by the `groupName` field). -Color panel options: `ui.colorPanel {mode?, options?}` picks the panel's mode as its panel menu does (`grayscale`, -`rgb`, `hsb`, `cmyk` or `websafe`; the active color converts to the mode's model as one undo step) and shows -(`options: true`) or hides (`false`) the options. It answers `{mode, options, shown}`: `mode` is null until a mode is -picked, and `shown` is the mode the panel shows the color in, or `tint` for a tint of a global or spot swatch. -Another mode, `lab` included, answers an error. The desktop app keeps both settings with its preferences, and -`ui.inspect` reports them as `ui.color_mode` and `ui.color_hide_options`. +Color panel options: `ui.colorPanel {mode?, options?, recentColors?}` picks the panel's mode as its panel menu does +(`grayscale`, `rgb`, `hsb`, `cmyk` or `websafe`; the active color converts to the mode's model as one undo step), +shows (`options: true`) or hides (`false`) the options, and checks (`recentColors: true`) or unchecks (`false`) Show +Recent Colors, which shows or hides the panel's Recent Colors row. Applied colors still join the list while the row +is hidden, and the Swatches panel keeps its own row. It answers `{mode, options, recentColors, shown}`: `mode` is null +until a mode is picked, and `shown` is the mode the panel shows the color in, or `tint` for a tint of a global or spot +swatch. Another mode, `lab` included, answers an error, as does an `options` or `recentColors` value that is not true +or false. The desktop app keeps the three settings with its preferences, and `ui.inspect` reports them as +`ui.color_mode`, `ui.color_hide_options` and `ui.color_show_recent_colors`. 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 5826c5c8c..85d77f0f1 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -470,7 +470,9 @@ objects' fills or strokes differ (`fillMixed` / `strokeMixed`, drawn as a "?" pr In the app's Color panel and Color Picker, RGB, HSB, hex and Web Safe RGB values describe the active working RGB space. RGB edits preserve the other native channels; HSB uses those same working RGB components. Colors outside display sRGB retain their native numeric values. `ui.colorPanel` selects the panel mode and `ui.colorPicker` -opens the picker through `run_command` with the remote backend. +opens the picker through `run_command` with the remote backend. `ui.colorPanel {"recentColors": false}` unchecks +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. | Tool | Arguments | Notes | |---|---|---| diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b4c949f74..8e4aa7016 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1268,6 +1268,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **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`. + 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 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. 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`).