Skip to content

Commit

Permalink
Fixed lookup logic for basic colors
Browse files Browse the repository at this point in the history
  • Loading branch information
troya2 committed Nov 24, 2024
1 parent 2581cf2 commit c8411c2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/ansi_richtext_parser/colorscheme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c8411c2

Please sign in to comment.