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, }