Skip to content

Commit dc7bab5

Browse files
committed
add blue, cyan, purple as known colors that can be used in colorize function
1 parent 11ae8fe commit dc7bab5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

easybuild/tools/output.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,19 @@
4848
pass
4949

5050

51+
COLOR_BLUE = 'blue'
52+
COLOR_CYAN = 'cyan'
5153
COLOR_GREEN = 'green'
54+
COLOR_PURPLE = 'purple'
5255
COLOR_RED = 'red'
5356
COLOR_YELLOW = 'yellow'
5457

5558
# map known colors to ANSII color codes
5659
KNOWN_COLORS = {
60+
COLOR_BLUE: '\033[0;34m',
61+
COLOR_CYAN: '\033[0;36m',
5762
COLOR_GREEN: '\033[0;32m',
63+
COLOR_PURPLE: '\033[0;35m',
5864
COLOR_RED: '\033[0;31m',
5965
COLOR_YELLOW: '\033[1;33m',
6066
}

test/framework/output.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,13 @@ def test_colorize(self):
130130
Test colorize function
131131
"""
132132
if HAVE_RICH:
133-
for color in ('green', 'red', 'yellow'):
133+
for color in ('blue', 'cyan', 'green', 'purple', 'red', 'yellow'):
134134
self.assertEqual(colorize('test', color), '[bold %s]test[/bold %s]' % (color, color))
135135
else:
136+
self.assertEqual(colorize('test', 'blue'), '\x1b[0;34mtest\x1b[0m')
137+
self.assertEqual(colorize('test', 'cyan'), '\x1b[0;36mtest\x1b[0m')
136138
self.assertEqual(colorize('test', 'green'), '\x1b[0;32mtest\x1b[0m')
139+
self.assertEqual(colorize('test', 'purple'), '\x1b[0;35mtest\x1b[0m')
137140
self.assertEqual(colorize('test', 'red'), '\x1b[0;31mtest\x1b[0m')
138141
self.assertEqual(colorize('test', 'yellow'), '\x1b[1;33mtest\x1b[0m')
139142

0 commit comments

Comments
 (0)