Catch a possible exception when trying to retrieve the rgb value in curses
Fixes #2354
This commit is contained in:
parent
4d7c01f8d0
commit
ecc40fdc5e
1 changed files with 4 additions and 1 deletions
|
@ -206,7 +206,10 @@ def ncurses_color_to_html(color):
|
|||
html color.
|
||||
"""
|
||||
if color <= 15:
|
||||
(r, g, b) = curses.color_content(color)
|
||||
try:
|
||||
(r, g, b) = curses.color_content(color)
|
||||
except: # fallback in faulty terminals (e.g. xterm)
|
||||
(r, g, b) = curses.color_content(color%8)
|
||||
r = r / 1000 * 6 - 0.01
|
||||
g = g / 1000 * 6 - 0.01
|
||||
b = b / 1000 * 6 - 0.01
|
||||
|
|
Loading…
Reference in a new issue