From 56aa3e56857a0dc13548d3de3f67366e0015e258 Mon Sep 17 00:00:00 2001 From: Ravi Tharuma Date: Thu, 23 Jul 2026 10:22:51 +0200 Subject: [PATCH] fix(theme): match Herdr default palette Use Catppuccin when inherited theme settings are absent, unreadable, invalid, or unknown, matching Herdr's own runtime fallback. Keep One Light as Navigator's standalone palette when inheritance is disabled. Co-Authored-By: Claude --- src/theme.rs | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/theme.rs b/src/theme.rs index ff706a0..7097f5c 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -412,16 +412,17 @@ impl Theme { } let path = herdr_config_path(); let Ok(s) = fs::read_to_string(path) else { - return Self::one_light(); + return Self::catppuccin(); }; let Ok(v) = s.parse::() else { - return Self::one_light(); + return Self::catppuccin(); }; Self::from_herdr_config(&v) } fn from_herdr_config(v: &toml::Value) -> Self { - let mut theme = Self::one_light(); + // Match Herdr's own fallback when [theme].name is absent or unknown. + let mut theme = Self::catppuccin(); if let Some(name) = v .get("theme") .and_then(|x| x.as_table()) @@ -562,6 +563,27 @@ mod tests { toml_src.parse::().expect("valid toml") } + #[test] + fn inherits_herdr_default_when_theme_is_not_configured() { + let theme = Theme::from_herdr_config(&theme_value("")); + + assert_eq!(theme.panel_bg, rgb(24, 24, 37)); + assert_eq!(theme.accent, rgb(137, 180, 250)); + } + + #[test] + fn unknown_theme_falls_back_to_herdr_default() { + let theme = Theme::from_herdr_config(&theme_value( + r#" + [theme] + name = "future-theme" + "#, + )); + + assert_eq!(theme.panel_bg, rgb(24, 24, 37)); + assert_eq!(theme.accent, rgb(137, 180, 250)); + } + #[test] fn inherits_rose_pine_dawn_and_custom_overrides() { let theme = Theme::from_herdr_config(&theme_value(