mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-21 01:45:32 +00:00
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 <noreply@anthropic.com> * contributors: drop the duplicate entry (already listed on main) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Web prefs test: junk storage keeps the new default (System) appearance Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Brandon Thomas <echelon@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
3 files changed
+4
-4
No files matched your search
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user