From c8411c2cd9d39f7cc33f87e5be8851a0a8757cea Mon Sep 17 00:00:00 2001 From: Troy Anderson Date: Sat, 23 Nov 2024 18:39:13 -0700 Subject: [PATCH] Fixed lookup logic for basic colors --- lib/ansi_richtext_parser/colorscheme.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/ansi_richtext_parser/colorscheme.dart b/lib/ansi_richtext_parser/colorscheme.dart index 7bebc6d..318cd46 100644 --- a/lib/ansi_richtext_parser/colorscheme.dart +++ b/lib/ansi_richtext_parser/colorscheme.dart @@ -101,9 +101,12 @@ class AnsiColorscheme { /// Converts an extended ANSI color code (0-255) into a Flutter `Color`. Color _extendedColor(int colorCode) { - if (colorCode < 16) { - // Basic ANSI colors (0-15) - return _bgMapping(colorCode); + if (colorCode < 8) { + // Basic ANSI colors (0-7) + return _fgMapping(colorCode + 30); + } else if (colorCode < 16) { + // Basic ANSI colors (8-15) + return _fgMapping(colorCode - 8 + 90); } else if (colorCode < 232) { // 6x6x6 color cube (216 colors) final code = colorCode - 16;