Skip to content

Commit b16ae0d

Browse files
committed
Unify and change color palette for both ANSI and Windows console
1 parent 347a146 commit b16ae0d

File tree

4 files changed

+28
-38
lines changed

4 files changed

+28
-38
lines changed

lib/kaitai/console_ansi.rb

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,21 @@ def goto(x, y)
4343

4444
COLORS = {
4545
black: 0,
46-
gray: 7,
47-
gray0: 232,
48-
gray1: 233,
49-
gray2: 234,
50-
gray3: 235,
51-
gray4: 236,
52-
gray5: 237,
53-
gray6: 238,
54-
gray7: 239,
55-
gray8: 240,
56-
gray9: 241,
57-
gray10: 242,
58-
gray11: 243,
59-
gray12: 244,
60-
gray13: 245,
61-
gray14: 246,
62-
gray15: 247,
63-
gray16: 248,
64-
gray17: 249,
65-
gray18: 250,
66-
gray19: 251,
67-
gray20: 252,
68-
gray21: 253,
69-
gray22: 254,
70-
gray23: 255
46+
red: 1,
47+
green: 2,
48+
yellow: 3,
49+
blue: 4,
50+
magenta: 5,
51+
cyan: 6,
52+
white: 7,
53+
gray: 8,
54+
bright_red: 9,
55+
bright_green: 10,
56+
bright_yellow: 11,
57+
bright_blue: 12,
58+
bright_magenta: 13,
59+
bright_cyan: 14,
60+
bright_white: 15
7161
}.freeze
7262

7363
def fg_color=(col)

lib/kaitai/console_windows.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,19 @@ def goto(x, y)
100100
black: 0,
101101
blue: 1,
102102
green: 2,
103-
aqua: 3,
103+
cyan: 3,
104104
red: 4,
105-
purple: 5,
105+
magenta: 5,
106106
yellow: 6,
107107
white: 7,
108108
gray: 8,
109-
light_blue: 9,
110-
light_green: 0xa,
111-
light_aqua: 0xb,
112-
light_red: 0xc,
113-
light_purple: 0xd,
114-
light_yellow: 0xe,
115-
bright_white: 0xf
109+
bright_blue: 9,
110+
bright_green: 10,
111+
bright_cyan: 11,
112+
bright_red: 12,
113+
bright_magenta: 13,
114+
bright_yellow: 14,
115+
bright_white: 15
116116
}.freeze
117117

118118
def fg_color=(col)

lib/kaitai/struct/visualizer/tree.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,12 @@ def draw_rec(n)
173173
if @ln == @cur_line
174174
# Seeking cur_node by cur_line
175175
@cur_node = n
176-
@ui.bg_color = :gray
176+
@ui.bg_color = :white
177177
@ui.fg_color = :black
178178
elsif @cur_node == n
179179
# Seeking cur_line by cur_node
180180
@cur_line = @ln
181-
@ui.bg_color = :gray
181+
@ui.bg_color = :white
182182
@ui.fg_color = :black
183183
end
184184

lib/kaitai/tui.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ def initialize
1313
if TUI.windows?
1414
require 'kaitai/console_windows'
1515
@console = ConsoleWindows.new
16-
@highlight_colors = %i[white aqua blue green white]
16+
@highlight_colors = %i[bright_white bright_cyan cyan gray]
1717
else
1818
require 'kaitai/console_ansi'
1919
@console = ConsoleANSI.new
20-
@highlight_colors = %i[gray14 gray11 gray8 gray5 gray2]
20+
@highlight_colors = %i[bright_white bright_cyan cyan gray]
2121
end
2222
end
2323

0 commit comments

Comments
 (0)