Remove duplicate "grey" theme, keep "dark" (ticket 004)
"grey" and "dark" rendered identically apart from accent colour, so drop "grey" as a selectable colour scheme everywhere in the frontend (index.css, api.ts's ColorScheme type, the NavMenu picker, the downloadable BUILTIN_THEMES table) and keep "dark" as the single equivalent theme. Existing settings.json files saved with color_scheme: "grey" keep loading correctly: the backend ColorScheme enum aliases the legacy "grey" serde value onto Dark, so old configs transparently migrate to "dark" without any manual intervention. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
e6e5bc8f50
commit
ed0be9726f
+15
-1
@@ -18,12 +18,17 @@ use crate::alerts::AlertRule;
|
||||
pub type SettingsHandle = Arc<Mutex<Settings>>;
|
||||
|
||||
/// User's preferred colour scheme for the webapp.
|
||||
///
|
||||
/// `Dark` accepts the legacy `"grey"` serde value (ticket 004: "grey" was a
|
||||
/// near-duplicate of "dark" and has been removed as a selectable option) so a
|
||||
/// settings file saved before that change still loads cleanly instead of
|
||||
/// falling back to `System`.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ColorScheme {
|
||||
Light,
|
||||
#[serde(alias = "grey")]
|
||||
Dark,
|
||||
Grey,
|
||||
Red,
|
||||
Green,
|
||||
Blue,
|
||||
@@ -316,6 +321,15 @@ mod tests {
|
||||
assert_eq!(reloaded, settings);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_grey_color_scheme_deserializes_as_dark() {
|
||||
let settings: Settings = serde_json::from_str(
|
||||
r#"{"color_scheme":"grey","css_entries":[],"custom_theme_id":null,"profiles":{"names":[],"active_profile":null,"profiles_dir":"profiles"},"max_logs":null,"alert_rules":[],"ntfy_topic":null,"ntfy_server":null}"#,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(settings.color_scheme, ColorScheme::Dark);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn round_trips_through_save_and_load() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user