Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Themes: default light theme to Pro Light to preserve the Pro layout (#5016) (#5029)

Sir Starch2ec1c8c0aaac
diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs
index 378f71c18..1dc82005d 100644
--- a/crates/engine/src/prefs.rs
+++ b/crates/engine/src/prefs.rs
@@ -58,7 +58,7 @@ choice!(ColorPicker { Adobe = "adobe", System = "system" } default Adobe);
choice!(Theme { Pro = "pro", ProMedium = "proMedium", ProLightGray = "proLightGray", ProLight = "proLight", Studio = "studio", StudioLight = "studioLight", Classic = "classic", SolarizedDark = "solarizedDark", Adwaita = "adwaita", AdwaitaDark = "adwaitaDark", BreezeLight = "breezeLight", BreezeDark = "breezeDark", SoftDark = "softDark", SoftLight = "softLight" } default ProMedium);
choice!(AppearanceMode { Auto = "auto", Dark = "dark", Light = "light" } default Dark);
choice!(DarkTheme { Pro = "pro", ProMedium = "proMedium", Studio = "studio", SolarizedDark = "solarizedDark", AdwaitaDark = "adwaitaDark", BreezeDark = "breezeDark", SoftDark = "softDark" } default ProMedium);
-choice!(LightTheme { StudioLight = "studioLight", ProLightGray = "proLightGray", ProLight = "proLight", Classic = "classic", Adwaita = "adwaita", BreezeLight = "breezeLight", SoftLight = "softLight" } default StudioLight);
+choice!(LightTheme { ProLight = "proLight", ProLightGray = "proLightGray", StudioLight = "studioLight", Classic = "classic", Adwaita = "adwaita", BreezeLight = "breezeLight", SoftLight = "softLight" } default ProLight);
choice!(CanvasColor { Default = "default", Black = "black", DarkGray = "darkGray", MediumGray = "mediumGray", LightGray = "lightGray", Custom = "custom" } default Default);
choice!(CanvasBorder { DropShadow = "dropShadow", Line = "line", None = "none" } default DropShadow);
choice!(UiScale { Auto = "auto", P75 = "75", P80 = "80", P85 = "85", P90 = "90", P95 = "95", P100 = "100", P125 = "125", P150 = "150", P175 = "175", P200 = "200", P250 = "250", P300 = "300" } default Auto);
@@ -293,7 +293,7 @@ impl Default for Interface {
theme: Theme::ProMedium,
appearance_mode: AppearanceMode::Dark,
dark_theme: DarkTheme::ProMedium,
- light_theme: LightTheme::StudioLight,
+ light_theme: LightTheme::ProLight,
favorite_themes: Vec::new(),
canvas_color: CanvasColor::Default,
canvas_custom_color: "#282828".into(),
diff --git a/crates/engine/src/prefs/tests.rs b/crates/engine/src/prefs/tests.rs
index 6bb34a970..36a5b69ab 100644
--- a/crates/engine/src/prefs/tests.rs
+++ b/crates/engine/src/prefs/tests.rs
@@ -55,9 +55,9 @@ fn appearance_defaults_and_legacy_theme_migrate() {
// New users keep Photoshop's default; following the system is opt-in.
assert_eq!(p.interface.appearance_mode, AppearanceMode::Dark);
assert_eq!(p.interface.dark_theme, DarkTheme::ProMedium);
- assert_eq!(p.interface.light_theme, LightTheme::StudioLight);
+ assert_eq!(p.interface.light_theme, LightTheme::ProLight);
for (theme, mode, dark, light) in
- [("pro", AppearanceMode::Dark, DarkTheme::Pro, LightTheme::StudioLight), ("classic", AppearanceMode::Light, DarkTheme::ProMedium, LightTheme::Classic)]
+ [("pro", AppearanceMode::Dark, DarkTheme::Pro, LightTheme::ProLight), ("classic", AppearanceMode::Light, DarkTheme::ProMedium, LightTheme::Classic)]
{
let mut s = Session::new();
s.load_prefs_json(&json!({"interface": {"theme": theme}}).to_string()).unwrap();
diff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rs
index cf0ff5196..f1da8775a 100644
--- a/crates/ui-egui/src/prefs_ui.rs
+++ b/crates/ui-egui/src/prefs_ui.rs
@@ -129,9 +129,9 @@ pub(crate) fn cycle_appearance(app: &mut PhotocraftApp, ctx: &egui::Context) {
}
const LIGHT_THEME_OPTIONS: &[(&str, ThemeKind)] = &[
- ("studioLight", ThemeKind::StudioLight),
- ("proLightGray", ThemeKind::ProLightGray),
("proLight", ThemeKind::ProLight),
+ ("proLightGray", ThemeKind::ProLightGray),
+ ("studioLight", ThemeKind::StudioLight),
("classic", ThemeKind::Classic),
("adwaita", ThemeKind::Adwaita),
("breezeLight", ThemeKind::BreezeLight),
@@ -2078,7 +2078,7 @@ mod tests {
fn appearance_resolves_both_saved_themes_and_follows_system() {
let mut interface = prefs::Interface { appearance_mode: AppearanceMode::Auto, ..prefs::Interface::default() };
assert_eq!(selected_theme(&interface, Some(egui::Theme::Dark)), ThemeKind::ProMedium);
- assert_eq!(selected_theme(&interface, Some(egui::Theme::Light)), ThemeKind::StudioLight);
+ assert_eq!(selected_theme(&interface, Some(egui::Theme::Light)), ThemeKind::ProLight);
interface.dark_theme = DarkTheme::Studio;
interface.light_theme = LightTheme::Classic;
assert_eq!(selected_theme(&interface, Some(egui::Theme::Dark)), ThemeKind::Studio);
@@ -2119,7 +2119,7 @@ mod tests {
app.run("prefs.set", json!({"path": "interface.appearanceMode", "value": "auto"})).unwrap();
let ctx = egui::Context::default();
tick(&mut app, &ctx);
- assert_eq!(app.ui.theme, ThemeKind::StudioLight);
+ assert_eq!(app.ui.theme, ThemeKind::ProLight);
}
#[test]
@@ -2232,13 +2232,13 @@ mod tests {
ctx.set_theme(egui::ThemePreference::Dark);
assert_eq!(ctx.options(|o| o.theme_preference), egui::ThemePreference::Dark);
appearance_frame(&mut app, &ctx, Some(egui::Theme::Light));
- assert_palette(&ctx, ThemeKind::StudioLight);
+ assert_palette(&ctx, ThemeKind::ProLight);
assert_eq!(app.session.prefs().interface.appearance_mode, AppearanceMode::Auto);
// A restored pin must also clear when the concrete PhotoCraft palette stays the same.
ctx.set_theme(egui::ThemePreference::Dark);
appearance_frame(&mut app, &ctx, Some(egui::Theme::Light));
assert_eq!(ctx.options(|o| o.theme_preference), egui::ThemePreference::System);
- assert_palette(&ctx, ThemeKind::StudioLight);
+ assert_palette(&ctx, ThemeKind::ProLight);
appearance_frame(&mut app, &ctx, Some(egui::Theme::Dark));
assert_palette(&ctx, ThemeKind::ProMedium);
assert_eq!(app.session.prefs().interface.appearance_mode, AppearanceMode::Auto);
diff --git a/crates/ui-egui/src/status_bar_tests.rs b/crates/ui-egui/src/status_bar_tests.rs
index 5f2e57685..eebd7e84b 100644
--- a/crates/ui-egui/src/status_bar_tests.rs
+++ b/crates/ui-egui/src/status_bar_tests.rs
@@ -196,3 +196,25 @@ fn fullscreen_status_zoom_preserves_shift_precision_and_recovers_from_the_minimu
h.run_steps(1);
assert!(h.state().ui.views[0].zoom > minimum, "reversing direction responds immediately after reaching a bound");
}
+
+/// #5016: toggling appearance between dark and light with default settings preserves the Pro
+/// layout and does not make a Fit button appear.
+#[test]
+fn appearance_toggle_preserves_pro_layout_and_has_no_fit_button() {
+ let mut h = harness(ThemeKind::ProMedium);
+ assert!(h.query_by_label("Fit").is_none());
+ assert!(Tokens::get(&h.ctx).pro);
+
+ // Switch to Light mode (top-bar appearance button).
+ let ctx = h.ctx.clone();
+ crate::prefs_ui::cycle_appearance(h.state_mut(), &ctx);
+ if h.state().session.prefs().interface.appearance_mode == photocraft_engine::prefs::AppearanceMode::Auto {
+ crate::prefs_ui::cycle_appearance(h.state_mut(), &ctx);
+ }
+ crate::prefs_ui::tick(h.state_mut(), &ctx);
+ h.run_steps(3);
+ assert_eq!(h.state().session.prefs().interface.appearance_mode, photocraft_engine::prefs::AppearanceMode::Light);
+ assert_eq!(h.state().ui.theme, ThemeKind::ProLight);
+ assert!(Tokens::get(&h.ctx).pro);
+ assert!(h.query_by_label("Fit").is_none(), "Fit button must not appear in light mode (#5016)");
+}
diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs
index eb61cfbea..0b2cc7c04 100644
--- a/crates/ui-egui/src/theme.rs
+++ b/crates/ui-egui/src/theme.rs
@@ -122,9 +122,9 @@ impl ThemeKind {
"pro" | "prodark" | "photoshop" | "dark" => Some(ThemeKind::Pro),
"promedium" | "promediumgray" | "medium" | "mediumgray" => Some(ThemeKind::ProMedium),
"prolightgray" | "lightgray" | "mediumlight" => Some(ThemeKind::ProLightGray),
- "prolight" | "prolightest" | "lightest" => Some(ThemeKind::ProLight),
+ "prolight" | "prolightest" | "lightest" | "light" => Some(ThemeKind::ProLight),
"studio" | "studiodark" => Some(ThemeKind::Studio),
- "studiolight" | "light" => Some(ThemeKind::StudioLight),
+ "studiolight" => Some(ThemeKind::StudioLight),
"classic" | "win2000" | "retro" => Some(ThemeKind::Classic),
"adwaita" | "adwaitalight" | "gnome" | "gnomelight" => Some(ThemeKind::Adwaita),
"adwaitadark" | "gnomedark" => Some(ThemeKind::AdwaitaDark),
@@ -1202,6 +1202,7 @@ mod tests {
assert_eq!(ThemeKind::from_name("Classic"), Some(ThemeKind::Classic));
assert_eq!(ThemeKind::from_name("studio (light)"), Some(ThemeKind::StudioLight));
assert_eq!(ThemeKind::from_name("dark"), Some(ThemeKind::Pro));
+ assert_eq!(ThemeKind::from_name("light"), Some(ThemeKind::ProLight));
assert_eq!(ThemeKind::from_name("studio"), Some(ThemeKind::Studio));
assert_eq!(ThemeKind::from_name("Pro (Medium Gray)"), Some(ThemeKind::ProMedium));
assert_eq!(ThemeKind::from_name("Solarized Dark"), Some(ThemeKind::SolarizedDark));
diff --git a/docs/ui-design.md b/docs/ui-design.md
index 4636cdb7c..13fd8b99f 100644
--- a/docs/ui-design.md
+++ b/docs/ui-design.md
@@ -19,7 +19,7 @@
Both Breeze themes are our own values close to Plasma's (not a copy of its colour schemes) and put text readability first: every text colour holds 4.5:1 on every surface and on hovered, pressed and selected states (`theme.rs` tests), so their secondary text, accent and status colours are darker (Light) or lighter (Dark) than Breeze's own, and the primary button is a deeper blue with white text.
-Edit → Preferences → Interface shows an Appearance Mode selector (Sync with system, Dark, Light) above separate light and dark theme cards with PhotoCraft editor previews and radio choices. Auto is opt-in and follows the operating system while the app is running. On Linux it reads the desktop portal once and then listens for its `SettingChanged` signal (no polling, and the UI repaints only when the value changes); `gsettings` runs at most once at start-up, by absolute path, when the portal gives no answer. A missing system appearance falls back to Dark. New installs keep Photoshop's default: Dark mode with Pro Medium (Studio Light is the saved light theme). Existing saved single-theme preferences migrate to a fixed Dark or Light mode with their chosen theme. The header appearance button cycles Auto → Light → Dark; its icon shows a monitor, moon or sun for the selected mode. Window → Theme and `ui.set {"theme":"classic"}` select a theme and fix the mode to its light or dark family.
+Edit → Preferences → Interface shows an Appearance Mode selector (Sync with system, Dark, Light) above separate light and dark theme cards with PhotoCraft editor previews and radio choices. Auto is opt-in and follows the operating system while the app is running. On Linux it reads the desktop portal once and then listens for its `SettingChanged` signal (no polling, and the UI repaints only when the value changes); `gsettings` runs at most once at start-up, by absolute path, when the portal gives no answer. A missing system appearance falls back to Dark. New installs keep Photoshop's default: Dark mode with Pro Medium (Pro Light is the saved light theme). Existing saved single-theme preferences migrate to a fixed Dark or Light mode with their chosen theme. The header appearance button cycles Auto → Light → Dark; its icon shows a monitor, moon or sun for the selected mode. Window → Theme and `ui.set {"theme":"classic"}` select a theme and fix the mode to its light or dark family.
Window → Theme and macOS PhotoCraft → Appearance also offer Sync with system. Its checkmark follows the saved Auto mode rather than the displayed palette; choosing a manual theme selects its fixed appearance mode.