diff options
author | Tim Oram <dev@mitmaro.ca> | 2021-01-28 21:03:52 -0330 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2021-01-28 21:29:31 -0330 |
commit | 1483e42eb42b02a307b5e5c129f52cb96da87634 (patch) | |
tree | 9f23393cf1ecebba1582ad4048fff48bc4340b7b | |
parent | 39b28d6f6e636b5d335568e1d79965003ab263ce (diff) |
Add support for true color support for macOS
Since true color support on macOS was broken with the curses backend,
with the rewrite to use Crossterm true color support can again be
enabled on macOS.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | src/display/utils.rs | 34 |
2 files changed, 1 insertions, 34 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index cd067ae..af785f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - The Git "diff.renames" and "diff.rename_limit" options are now respected during show commit - End and Home support during edit - Optional rollback on error or invalid file during external edit +- True color support on macOS ### Changed - No longer based on Curses and instead using Crossterm diff --git a/src/display/utils.rs b/src/display/utils.rs index 4115be7..c044bbd 100644 --- a/src/display/utils.rs +++ b/src/display/utils.rs @@ -24,15 +24,6 @@ pub(super) fn detect_color_mode(number_of_colors: u16) -> ColorMode { } } - // Apple has some special cases - if let Ok(term_program) = var("TERM_PROGRAM") { - // Apple Terminal sometimes pretends to support TrueColor, but it's 8bit - // TODO iTerm does support truecolor, but does not support the way that colors are set - if term_program == "Apple_Terminal" || term_program == "iTerm.app" { - return ColorMode::EightBit; - } - } - // Assume terminals with `-256` are 8bit if let Ok(term) = var("TERM") { if term.contains("-256") { @@ -193,7 +184,6 @@ mod tests { fn clear_env() { remove_var("COLORTERM"); remove_var("TERM"); - remove_var("TERM_PROGRAM"); remove_var("VTE_VERSION"); remove_var("WT_SESSION"); } @@ -272,30 +262,6 @@ mod tests { #[test] #[serial] - fn detect_color_mode_term_program_env_apple_terminal() { - clear_env(); - set_var("TERM_PROGRAM", "Apple_Terminal"); - assert_eq!(detect_color_mode(0), ColorMode::EightBit); - } - - #[test] - #[serial] - fn detect_color_mode_term_program_env_iterm() { - clear_env(); - set_var("TERM_PROGRAM", "iTerm.app"); - assert_eq!(detect_color_mode(0), ColorMode::EightBit); - } - - #[test] - #[serial] - fn detect_color_mode_term_program_env_other() { - clear_env(); - set_var("TERM_PROGRAM", "other"); - assert_eq!(detect_color_mode(0), ColorMode::TwoTone); - } - - #[test] - #[serial] fn detect_color_mode_vte_version_0_36_00() { clear_env(); set_var("VTE_VERSION", "3600"); |