Skip to content

Commit e2e8d8c

Browse files
committed
fix in ANSI_COLOR_NAMES logic
1 parent 99225cb commit e2e8d8c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

prompt_toolkit/styles/from_dict.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ def _colorformat(text):
2424
Like in Pygments, but also support the ANSI color names.
2525
(These will map to the colors of the 16 color palette.)
2626
"""
27-
if text[0:1] == '#':
27+
if text == '' or text in ANSI_COLOR_NAMES:
28+
return text
29+
elif text[0:1] == '#':
2830
col = text[1:]
2931
if len(col) == 6:
3032
return col
3133
elif len(col) == 3:
3234
return col[0]*2 + col[1]*2 + col[2]*2
33-
elif text == '' or (text in ANSI_COLOR_NAMES):
34-
return text
3535

3636
raise ValueError('Wrong color format %r' % text)
3737

0 commit comments

Comments
 (0)