feat(ui): Darken and Lighten Interface (Ctrl/Cmd+Shift+F1, F2) (#3709)

* feat(ui): Darken and Lighten Interface (Ctrl/Cmd+Shift+F1, F2)

Photoshop's Shift+Ctrl+F1 (⇧⌘F1 on macOS) darkens the interface by one of
its four brightnesses and Shift+Ctrl+F2 lightens it, stopping at the
darkest and lightest. PhotoCraft has the same four as themes (Pro, Pro
Medium Gray, Pro Light Gray, Pro Light), so view.darkenInterface and
view.lightenInterface step through them from the theme on screen and save
the choice like picking it in Preferences › Interface (setting the dark or
light theme and the matching appearance). From another theme they step
from the nearest brightness: Medium Gray for a dark one, Light Gray for a
light one. They work with no document open. Both labels are in every
catalogue.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(i18n): Vietnamese strings for Darken and Lighten Interface

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(i18n): Hungarian and Turkish strings for Darken and Lighten Interface

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* i18n(sr): translate Darken and Lighten Interface

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Brandon Thomas <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-10-14 13:47:09 -04:00
1 parent da6ceeaf96
commit c208e8ffc1
22 files changed
+166

No files matched your search

+4
View File
@@ -3753,6 +3753,10 @@ navigator Zoom Zvětšení
Sent to {printer} Odesláno do {printer}
set in Print Settings… nastavuje se v nastavení tisku…
ICO is limited to 256 × 256 pixels ICO je omezen na 256 × 256 pixelů
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Ztmavit rozhraní
Lighten Interface Zesvětlit rozhraní
# Bevel & Emboss Technique.
Technique Technika
Chisel Hard Tvrdé tesání
Can't render this file because it contains an unexpected character in line 6 and column 47.
+4
View File
@@ -3143,6 +3143,10 @@ curves Smooth Glätten
Sent to {printer} An {printer} gesendet
set in Print Settings… in den Druckeinstellungen festlegen…
ICO is limited to 256 × 256 pixels ICO ist auf 256 × 256 Pixel begrenzt
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Benutzeroberfläche abdunkeln
Lighten Interface Benutzeroberfläche aufhellen
# Bevel & Emboss Technique.
Technique Technik
Chisel Hard Meißeln hart
Can't render this file because it contains an unexpected character in line 6 and column 47.
+4
View File
@@ -3843,6 +3843,10 @@ curves Smooth Εξομάλυνση
Sent to {printer} Στάλθηκε στον {printer}
set in Print Settings… ορίζεται στις ρυθμίσεις εκτύπωσης…
ICO is limited to 256 × 256 pixels Το ICO περιορίζεται σε 256 × 256 εικονοστοιχεία
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Σκουρότερο περιβάλλον
Lighten Interface Φωτεινότερο περιβάλλον
# Bevel & Emboss Technique.
Technique Τεχνική
Chisel Hard Σκληρή σμίλευση
Can't render this file because it contains an unexpected character in line 1029 and column 18.
+4
View File
@@ -2830,6 +2830,10 @@ curves Smooth Suavizar
Sent to {printer} Enviado a {printer}
set in Print Settings… se establece en Ajustes de impresión…
ICO is limited to 256 × 256 pixels ICO está limitado a 256 × 256 píxeles
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Oscurecer interfaz
Lighten Interface Aclarar interfaz
# Bevel & Emboss Technique.
Technique Técnica
Chisel Hard Cincelar duro
Can't render this file because it contains an unexpected character in line 4 and column 47.
+4
View File
@@ -3147,6 +3147,10 @@ curves Smooth Lisser
Sent to {printer} Envoyé à {printer}
set in Print Settings… défini dans les paramètres d’impression…
ICO is limited to 256 × 256 pixels Le format ICO est limité à 256 × 256 pixels
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Assombrir l'interface
Lighten Interface Éclaircir l'interface
# Bevel & Emboss Technique.
Technique Technique
Chisel Hard Ciselage dur
Can't render this file because it contains an unexpected character in line 6 and column 47.
+4
View File
@@ -4066,6 +4066,10 @@ cameraRaw Yellow Sárga
Ink Characteristics Festék jellemzői
Solidity: Fedőképesség:
Redrawing Újrarajzolás
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Felület sötétítése
Lighten Interface Felület világosítása
# Bevel & Emboss Technique.
Technique Technika
Chisel Hard Kemény vésés
Can't render this file because it contains an unexpected character in line 6 and column 47.
+4
View File
@@ -3134,6 +3134,10 @@ curves Smooth Haluskan
Sent to {printer} Dikirim ke {printer}
set in Print Settings… diatur di Pengaturan Cetak…
ICO is limited to 256 × 256 pixels ICO dibatasi hingga 256 × 256 piksel
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Gelapkan Antarmuka
Lighten Interface Cerahkan Antarmuka
# Bevel & Emboss Technique.
Technique Teknik
Chisel Hard Pahat Keras
Can't render this file because it contains an unexpected character in line 4 and column 47.
+3
View File
@@ -4108,6 +4108,9 @@ navigator Zoom Zoom
Sent to {printer} Inviato a {printer}
set in Print Settings… impostato nelle impostazioni di stampa…
ICO is limited to 256 × 256 pixels ICO è limitato a 256 × 256 pixel
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Scurisci interfaccia
Lighten Interface Schiarisci interfaccia
# Bevel & Emboss Technique.
Technique Tecnica
Chisel Hard Cesello duro
Can't render this file because it contains an unexpected character in line 2647 and column 53.
+3
View File
@@ -3822,6 +3822,9 @@ curves Smooth スムーズ
Reset All Locked Settings ロックされた設定をすべて初期化
Copy Texture to Other Tools テクスチャを他のツールにコピー
ICO is limited to 256 × 256 pixels ICO は 256 × 256 ピクセルまでです
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface インターフェイスを暗くする
Lighten Interface インターフェイスを明るくする
# Bevel & Emboss Technique.
Technique テクニック
Chisel Hard チゼルハード
Can't render this file because it contains an unexpected character in line 6 and column 47.
+4
View File
@@ -3320,6 +3320,10 @@ curves Smooth 매끄럽게
Sent to {printer} {printer}(으)로 전송됨
set in Print Settings… 인쇄 설정에서 지정…
ICO is limited to 256 × 256 pixels ICO는 256 × 256픽셀로 제한됩니다
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface 인터페이스 어둡게
Lighten Interface 인터페이스 밝게
# Bevel & Emboss Technique.
Technique 기법
Chisel Hard 단단하게 조각
Can't render this file because it contains an unexpected character in line 3160 and column 53.
+4
View File
@@ -3905,6 +3905,10 @@ curves Smooth Vloeiend maken
Sent to {printer} Verzonden naar {printer}
set in Print Settings… instellen in de afdrukinstellingen…
ICO is limited to 256 × 256 pixels ICO is beperkt tot 256 × 256 pixels
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Interface donkerder maken
Lighten Interface Interface lichter maken
# Bevel & Emboss Technique.
Technique Techniek
Chisel Hard Beitel hard
Can't render this file because it contains an unexpected character in line 8 and column 34.
+4
View File
@@ -3743,6 +3743,10 @@ curves Smooth Wygładź
Sent to {printer} Wysłano do {printer}
set in Print Settings… ustawiane w ustawieniach druku…
ICO is limited to 256 × 256 pixels ICO jest ograniczony do 256 × 256 pikseli
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Przyciemnij interfejs
Lighten Interface Rozjaśnij interfejs
# Bevel & Emboss Technique.
Technique Technika
Chisel Hard Dłuto twarde
Can't render this file because it contains an unexpected character in line 6 and column 47.
+4
View File
@@ -3935,6 +3935,10 @@ layerLabel No Color Sem cor
Sent to {printer} Enviado para {printer}
set in Print Settings… definido nas configurações de impressão…
ICO is limited to 256 × 256 pixels ICO é limitado a 256 × 256 pixels
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Escurecer interface
Lighten Interface Clarear interface
# Bevel & Emboss Technique.
Technique Técnica
Chisel Hard Cinzel duro
Can't render this file because it contains an unexpected character in line 6 and column 47.
+4
View File
@@ -3111,6 +3111,10 @@ curves Smooth Сгладить
Gray Value (Median) Уровень серого (медиана)
Integrated Density Интегральная плотность
Length Длина
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Сделать интерфейс темнее
Lighten Interface Сделать интерфейс светлее
# Bevel & Emboss Technique.
Technique Метод
Chisel Hard Жесткая огранка
Can't render this file because it contains an unexpected character in line 6 and column 47.
+4
View File
@@ -4219,6 +4219,10 @@ shape Appearance Izgled
Ink Characteristics Karakteristike mastila
Solidity: Punoća:
Redrawing Ponovno iscrtavanje
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Zatamni interfejs
Lighten Interface Posvetli interfejs
# Bevel & Emboss Technique.
Technique Tehnika
Chisel Hard Tvrdo klesanje
Can't render this file because it contains an unexpected character in line 6 and column 47.
+4
View File
@@ -3877,6 +3877,10 @@ cameraData Lens Lens
Ink Characteristics Mürekkep Özellikleri
Solidity: Doluluk:
Redrawing Yeniden çiziliyor
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Arayüzü koyulaştır
Lighten Interface Arayüzü açıklaştır
# Bevel & Emboss Technique.
Technique Teknik
Chisel Hard Sert Keski
Can't render this file because it contains an unexpected character in line 8 and column 34.
+4
View File
@@ -3844,6 +3844,10 @@ curves Smooth Згладити
Sent to {printer} Надіслано на {printer}
set in Print Settings… задається в параметрах друку…
ICO is limited to 256 × 256 pixels ICO обмежено розміром 256 × 256 пікселів
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Зробити інтерфейс темнішим
Lighten Interface Зробити інтерфейс світлішим
# Bevel & Emboss Technique.
Technique Метод
Chisel Hard Жорстке різьблення
Can't render this file because it contains an unexpected character in line 1387 and column 18.
+4
View File
@@ -3632,6 +3632,10 @@ curves Smooth Làm mượt
Sent to {printer} Đã gửi tới {printer}
set in Print Settings… đặt trong thiết lập in…
ICO is limited to 256 × 256 pixels ICO giới hạn ở 256 × 256 pixel
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface Làm tối giao diện
Lighten Interface Làm sáng giao diện
# Bevel & Emboss Technique.
Technique Kỹ thuật
Chisel Hard Đục cứng
Can't render this file because it contains an unexpected character in line 6 and column 47.
+4
View File
@@ -2755,6 +2755,10 @@ curves Smooth 平滑
Sent to {printer} 已发送到 {printer}
set in Print Settings… 在打印设置中设置…
ICO is limited to 256 × 256 pixels ICO 最大为 256 × 256 像素
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface 界面变暗
Lighten Interface 界面变亮
# Bevel & Emboss Technique.
Technique 方法
Chisel Hard 雕刻清晰
Can't render this file because it contains an unexpected character in line 2593 and column 53.
+4
View File
@@ -2740,6 +2740,10 @@ curves Smooth 平滑
Sent to {printer} 已傳送至 {printer}
set in Print Settings… 在列印設定中設定…
ICO is limited to 256 × 256 pixels ICO 最大為 256 × 256 像素
# Darken / Lighten Interface (⇧⌘F1 / ⇧⌘F2)
Darken Interface 介面變暗
Lighten Interface 介面變亮
# Bevel & Emboss Technique.
Technique 方法
Chisel Hard 雕刻清晰
Can't render this file because it contains an unexpected character in line 6 and column 47.
+9
View File
@@ -53,6 +53,9 @@ pub const UI_COMMANDS: &[(&str, &str, &[&str], Option<&str>)] = &[
("view.extras", "Extras", &["View"], Some("Cmd+H")),
("view.show.targetPath", "Target Path", &["View", "Show"], Some("Cmd+Shift+H")),
("view.screenMode.cycle", "Cycle Screen Mode", &[], Some("F")),
// Photoshop's interface brightness shortcuts: step through the four Pro themes.
("view.darkenInterface", "Darken Interface", &[], Some("Cmd+Shift+F1")),
("view.lightenInterface", "Lighten Interface", &[], Some("Cmd+Shift+F2")),
("edit.freeTransformCopy", "Free Transform a Copy", &[], Some("Cmd+Alt+T")),
("type.editText", "Edit Type", &[], None),
("view.zoomIn", "Zoom In", &["View"], Some("Cmd+=")),
@@ -376,6 +379,10 @@ pub(crate) fn invoke_unguarded(app: &mut PhotocraftApp, ctx: &egui::Context, id:
crate::prefs_ui::cycle_appearance(app, ctx);
Ok(Value::Null)
}
"view.darkenInterface" | "view.lightenInterface" => {
crate::prefs_ui::step_brightness(app, ctx, id == "view.lightenInterface")?;
Ok(json!({"theme": app.ui.theme.id()}))
}
"window.theme.system" => {
app.run("prefs.set", json!({"path": "interface.appearanceMode", "value": "auto"}))?;
crate::prefs_ui::sync_appearance(app, ctx);
@@ -752,6 +759,8 @@ pub fn is_enabled(app: &PhotocraftApp, id: &str) -> bool {
i if i.starts_with(DOCUMENT_ITEM) => true,
i if crate::links::url_for(i).is_some() => true,
i if i.starts_with("window.theme.") => true,
// Interface brightness works with or without a document, as in Photoshop.
"view.darkenInterface" | "view.lightenInterface" => true,
"file.save" | "file.saveAs" | "file.export.exportAs" | "file.export.quickExportAsPng" => {
app.session.active().is_some() && app.services.export.is_some()
}
+79
View File
@@ -128,6 +128,26 @@ pub(crate) fn cycle_appearance(app: &mut PhotocraftApp, ctx: &egui::Context) {
}
}
/// Photoshop's four interface brightnesses, darkest first.
const BRIGHTNESSES: [ThemeKind; 4] = [ThemeKind::Pro, ThemeKind::ProMedium, ThemeKind::ProLightGray, ThemeKind::ProLight];
/// Darken Interface (⇧⌘F1, `lighter` false) and Lighten Interface (⇧⌘F2): the next of
/// Photoshop's four brightnesses from the theme on screen, stopping at either end, as in
/// Photoshop. Another theme steps from the nearest brightness: Medium Gray for a dark one, Light
/// Gray for a light one. The choice is saved like picking it in Preferences › Interface.
pub(crate) fn step_brightness(app: &mut PhotocraftApp, ctx: &egui::Context, lighter: bool) -> Result<(), String> {
let current = app.ui.theme;
let at = BRIGHTNESSES.iter().position(|k| *k == current).unwrap_or(if crate::theme::Tokens::for_kind(current).dark() { 1 } else { 2 });
let next = if lighter { (at + 1).min(BRIGHTNESSES.len() - 1) } else { at.saturating_sub(1) };
let Some(&kind) = BRIGHTNESSES.get(next) else { return Ok(()) };
if kind == current {
return Ok(());
}
app.run("prefs.set", json!({"path": "interface.theme", "value": kind.id()}))?;
sync_appearance(app, ctx);
Ok(())
}
const LIGHT_THEME_OPTIONS: &[(&str, ThemeKind)] = &[
("proLight", ThemeKind::ProLight),
("proLightGray", ThemeKind::ProLightGray),
@@ -2169,6 +2189,65 @@ mod tests {
}
}
#[test]
fn darken_and_lighten_interface_step_through_photoshops_brightnesses_and_stop_at_the_ends() {
let ctx = egui::Context::default();
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
sync_appearance(&mut app, &ctx);
assert_eq!(app.ui.theme, ThemeKind::ProMedium, "Photoshop's default brightness");
let press = |app: &mut PhotocraftApp, id: &str| crate::menus::invoke(app, &ctx, id, json!({})).unwrap();
for expected in [ThemeKind::ProLightGray, ThemeKind::ProLight, ThemeKind::ProLight] {
press(&mut app, "view.lightenInterface");
assert_eq!(app.ui.theme, expected);
}
// Saved like a choice in Preferences › Interface: the light slot and the Light appearance.
let i = &app.session.prefs().interface;
assert_eq!((i.appearance_mode, i.light_theme), (AppearanceMode::Light, LightTheme::ProLight));
for expected in [ThemeKind::ProLightGray, ThemeKind::ProMedium, ThemeKind::Pro, ThemeKind::Pro] {
press(&mut app, "view.darkenInterface");
assert_eq!(app.ui.theme, expected);
}
let i = &app.session.prefs().interface;
assert_eq!((i.appearance_mode, i.dark_theme), (AppearanceMode::Dark, DarkTheme::Pro));
// Another theme steps from the nearest brightness.
for (theme, id, expected) in [
("studio", "view.darkenInterface", ThemeKind::Pro),
("studio", "view.lightenInterface", ThemeKind::ProLightGray),
("classic", "view.darkenInterface", ThemeKind::ProMedium),
("classic", "view.lightenInterface", ThemeKind::ProLight),
] {
app.run("prefs.set", json!({"path": "interface.theme", "value": theme})).unwrap();
sync_appearance(&mut app, &ctx);
press(&mut app, id);
assert_eq!(app.ui.theme, expected, "{theme} {id}");
}
}
#[test]
fn ctrl_shift_f1_and_f2_darken_and_lighten_the_interface() {
for (id, shortcut) in [("view.darkenInterface", "Cmd+Shift+F1"), ("view.lightenInterface", "Cmd+Shift+F2")] {
assert_eq!(crate::shortcuts::default_shortcut(id).as_deref(), Some(shortcut), "{id}");
}
let ctx = egui::Context::default();
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
sync_appearance(&mut app, &ctx);
let press = |app: &mut PhotocraftApp, key| {
let modifiers = egui::Modifiers::COMMAND | egui::Modifiers::SHIFT;
let raw = egui::RawInput {
events: vec![egui::Event::ModifiersChanged(modifiers), egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers }],
..Default::default()
};
ctx.begin_pass(raw);
crate::shortcuts::handle(app, &ctx);
ctx.end_pass().textures_delta.clear();
};
press(&mut app, egui::Key::F1);
assert_eq!(app.ui.theme, ThemeKind::Pro);
press(&mut app, egui::Key::F2);
press(&mut app, egui::Key::F2);
assert_eq!(app.ui.theme, ThemeKind::ProLightGray);
}
fn appearance_frame(app: &mut PhotocraftApp, ctx: &egui::Context, appearance: Option<egui::Theme>) {
ctx.run_ui(egui::RawInput { system_theme: appearance, ..Default::default() }, |ui| tick(app, ui.ctx())).textures_delta.clear();
}