diff options
author | Omnikar | 2021-11-14 12:26:48 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-12-13 15:47:18 +0000 |
commit | 98ce2a301da25152563137047377026d72fd644c (patch) | |
tree | 1e33160822106b7c84be3c7084c2b773fbece444 /helix-term/src/lib.rs | |
parent | 43d17c482cda07fa0dc4985d60c14391a4926940 (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-term/src/lib.rs')
-rw-r--r-- | helix-term/src/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/helix-term/src/lib.rs b/helix-term/src/lib.rs index f5e3a8cd..4fe76cd5 100644 --- a/helix-term/src/lib.rs +++ b/helix-term/src/lib.rs @@ -9,3 +9,9 @@ pub mod config; pub mod job; pub mod keymap; pub mod ui; + +fn true_color() -> bool { + std::env::var("COLORTERM") + .map(|v| matches!(v.as_str(), "truecolor" | "24bit")) + .unwrap_or(false) +} |