Unnamed repository; edit this file 'description' to name the repository.
warn when configured theme is unusable for color reasons (#13058)
if `config.toml` either does not have `editor.true-color` or sets it to false, many (most?) themes stop being usable. when loading such a theme, Helix falls back to the default theme, but didn't mention this anywhere - even in `~/.cache/helix/helix.log` when run with `-v`. if this occurs when reloading a theme at runtime with `:theme`, there's a fairly helpful error about > `theme requires true color support` seems worth logging about this if it happens during startup too.
iximeow 12 months ago
parent e74956f · commit d1e0891
-rw-r--r--helix-term/src/application.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 7f491309..cb270b86 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -441,7 +441,17 @@ impl Application {
e
})
.ok()
- .filter(|theme| (true_color || theme.is_16_color()))
+ .filter(|theme| {
+ let colors_ok = true_color || theme.is_16_color();
+ if !colors_ok {
+ log::warn!(
+ "loaded theme `{}` but cannot use it because true color \
+ support is not enabled",
+ theme.name()
+ );
+ }
+ colors_ok
+ })
})
.unwrap_or_else(|| editor.theme_loader.default_theme(true_color));
editor.set_theme(theme);