There was an error while loading. Please reload this page.
1 parent 99225cb commit e2e8d8cCopy full SHA for e2e8d8c
prompt_toolkit/styles/from_dict.py
@@ -24,14 +24,14 @@ def _colorformat(text):
24
Like in Pygments, but also support the ANSI color names.
25
(These will map to the colors of the 16 color palette.)
26
"""
27
- if text[0:1] == '#':
+ if text == '' or text in ANSI_COLOR_NAMES:
28
+ return text
29
+ elif text[0:1] == '#':
30
col = text[1:]
31
if len(col) == 6:
32
return col
33
elif len(col) == 3:
34
return col[0]*2 + col[1]*2 + col[2]*2
- elif text == '' or (text in ANSI_COLOR_NAMES):
- return text
35
36
raise ValueError('Wrong color format %r' % text)
37
0 commit comments