aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/editor.rs
diff options
context:
space:
mode:
authorOmnikar2021-11-14 12:26:48 +0000
committerBlaž Hrastnik2021-12-13 15:47:18 +0000
commit98ce2a301da25152563137047377026d72fd644c (patch)
tree1e33160822106b7c84be3c7084c2b773fbece444 /helix-view/src/editor.rs
parent43d17c482cda07fa0dc4985d60c14391a4926940 (diff)
Load alt default theme if true color is not supported
* Move `runtime/themes/base16_default_terminal.toml` to `base16_theme.toml` alongside `theme.toml` * Use `terminfo` crate to detect whether the terminal supports true color and, if the user has no theme configured and their terminal does not support true color, load the alt default theme instead of the normal default. Remove `terminfo` dependency, use `COLORTERM` env instead Prevent user from switching to an unsupported theme Add `true-color-override` option If the terminal is wrongly detected to not support true color, `true-color-override = true` will override the detection. Rename `true-color-override` to `true-color`
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r--helix-view/src/editor.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index dcbcbe4f..753defa1 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -105,6 +105,8 @@ pub struct Config {
/// Whether to display infoboxes. Defaults to true.
pub auto_info: bool,
pub file_picker: FilePickerConfig,
+ /// Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative. Defaults to `false`.
+ pub true_color: bool,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)]
@@ -137,6 +139,7 @@ impl Default for Config {
completion_trigger_len: 2,
auto_info: true,
file_picker: FilePickerConfig::default(),
+ true_color: false,
}
}
}
@@ -265,15 +268,6 @@ impl Editor {
self._refresh();
}
- pub fn set_theme_from_name(&mut self, theme: &str) -> anyhow::Result<()> {
- let theme = self
- .theme_loader
- .load(theme.as_ref())
- .with_context(|| format!("failed setting theme `{}`", theme))?;
- self.set_theme(theme);
- Ok(())
- }
-
/// Refreshes the language server for a given document
pub fn refresh_language_server(&mut self, doc_id: DocumentId) -> Option<()> {
let doc = self.documents.get_mut(&doc_id)?;