diff --git a/crates/hyfetch/src/bin/hyfetch.rs b/crates/hyfetch/src/bin/hyfetch.rs
index 8daa1b26..a8673a33 100644
--- a/crates/hyfetch/src/bin/hyfetch.rs
+++ b/crates/hyfetch/src/bin/hyfetch.rs
@@ -87,7 +87,16 @@ fn main() -> Result<()> {
};
let color_mode = options.mode.unwrap_or(config.mode);
- let theme = config.light_dark;
+ let auto_detect_light_dark = options
+ .auto_detect_light_dark
+ .unwrap_or_else(|| config.auto_detect_light_dark.unwrap_or(false));
+ let theme = if auto_detect_light_dark {
+ let res = det_bg();
+ res?.map(|bg| bg.theme())
+ .unwrap_or(config.light_dark.unwrap_or_default())
+ } else {
+ config.light_dark.unwrap_or_default()
+ };
// Check if it's June (pride month)
let now =
@@ -131,7 +140,12 @@ fn main() -> Result<()> {
} else if let Some(lightness) = options.lightness {
color_profile.with_lightness(AssignLightness::Replace(lightness))
} else {
- color_profile.with_lightness_adaptive(config.lightness(), theme)
+ color_profile.with_lightness_adaptive(
+ config
+ .lightness
+ .unwrap_or_else(|| Config::default_lightness(theme)),
+ theme,
+ )
};
debug!(?color_profile, "lightened color profile");
@@ -187,6 +201,22 @@ fn load_config(path: &PathBuf) -> Result