From 7567c41143a58b6fc48173b3d019d6ec4a9419cc Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Thu, 6 Apr 2023 13:00:30 +0200 Subject: [PATCH] fix(dtmm): Fix ANSI color parsing --- crates/dtmm/src/util/ansi.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/crates/dtmm/src/util/ansi.rs b/crates/dtmm/src/util/ansi.rs index f827c7d..24855fc 100644 --- a/crates/dtmm/src/util/ansi.rs +++ b/crates/dtmm/src/util/ansi.rs @@ -67,13 +67,15 @@ pub fn ansi_to_rich_text(input: &str) -> RichText { state.color = match col { // This escape code is usually called 'black', but is actually used // as "foreground color", in regards to light themes. - 1 => Some(theme::COLOR_FG), - 2 => Some(theme::COLOR_RED_LIGHT), - 3 => Some(theme::COLOR_GREEN_LIGHT), - 4 => Some(theme::COLOR_YELLOW_LIGHT), - 5 => Some(theme::COLOR_BLUE_LIGHT), - 6 => Some(theme::COLOR_PURPLE_LIGHT), - 7 => Some(theme::COLOR_AQUA_LIGHT), + 0 => Some(theme::COLOR_FG), + 1 => Some(theme::COLOR_RED_LIGHT), + 2 => Some(theme::COLOR_GREEN_LIGHT), + 3 => Some(theme::COLOR_YELLOW_LIGHT), + 4 => Some(theme::COLOR_BLUE_LIGHT), + 5 => Some(theme::COLOR_PURPLE_LIGHT), + 6 => Some(theme::COLOR_AQUA_LIGHT), + // Similarly, 'white' is the background color + 7 => Some(theme::COLOR_BG), 9 => None, _ => unreachable!(), }; -- 2.45.3