From 8701f4e28d218eadf725f240fc08bea4a9c473b4 Mon Sep 17 00:00:00 2001 From: Debarghaya Mitra <175645893+GhostMitra@users.noreply.github.com> Date: Sun, 18 Oct 2026 13:53:13 +0530 Subject: [PATCH] Theme: default to system appearance (#718) * Theme: default to system appearance Sets Appearance::System as the default variant for ThemePreference, so fresh installs and unconfigured preference files follow the host OS appearance dynamically. * contributors: add the missing blank line Co-Authored-By: Claude Opus 5.5 * contributors: drop the duplicate entry (already listed on main) Co-Authored-By: Claude Opus 5.5 * Web prefs test: junk storage keeps the new default (System) appearance Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Brandon Thomas Co-authored-by: Claude Opus 5.5 --- apps/wordcraft-web/src/prefs.rs | 2 +- crates/ui-egui/src/lib.rs | 4 ++-- crates/ui-egui/src/theme.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/wordcraft-web/src/prefs.rs b/apps/wordcraft-web/src/prefs.rs index bf5ec46d56..232688c14b 100644 --- a/apps/wordcraft-web/src/prefs.rs +++ b/apps/wordcraft-web/src/prefs.rs @@ -82,7 +82,7 @@ mod tests { for junk in [None, Some(""), Some("not json"), Some("[1,2]"), Some("{\"theme\":42}")] { let mut a = app(); restore(&mut a, junk); - assert_eq!(a.ui.theme, wordcraft_ui_egui::theme::Appearance::Light); + assert_eq!(a.ui.theme, wordcraft_ui_egui::theme::Appearance::System, "junk keeps the default appearance"); } } } diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index b662f775a2..9e0f72cbb9 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -6063,7 +6063,7 @@ mod tests { #[test] fn interface_theme_migrates_and_survives_a_restart() { use theme::Appearance; - for (saved, want) in [(r#"{"dark": false}"#, Appearance::Light), (r#"{"dark": true}"#, Appearance::Dark), ("{}", Appearance::Light)] { + for (saved, want) in [(r#"{"dark": false}"#, Appearance::Light), (r#"{"dark": true}"#, Appearance::Dark), ("{}", Appearance::System)] { let mut a = app(); a.apply_prefs(serde_json::from_str(saved).unwrap()); assert_eq!(a.ui.theme, want, "{saved}"); @@ -6077,7 +6077,7 @@ mod tests { assert_eq!(b.ui.theme, Appearance::System); // An unknown saved value keeps the rest of the preferences. let odd: UiState = serde_json::from_str(r#"{"theme": "sepia", "tab": "Insert"}"#).unwrap(); - assert_eq!((odd.theme, odd.tab.as_str()), (Appearance::Light, "Insert")); + assert_eq!((odd.theme, odd.tab.as_str()), (Appearance::System, "Insert")); } /// #475, #822: the interface size is kept between runs; junk saved values read as Auto and diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index a14b94f989..b9c12394f8 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -14,9 +14,9 @@ pub const APP_INK: Color32 = Color32::from_rgb(0x2B, 0x47, 0xB5); #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)] #[serde(from = "String", into = "String")] pub enum Appearance { - #[default] Light, Dark, + #[default] System, }