summaryrefslogtreecommitdiff
path: root/src/xhtml.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/xhtml.py')
-rw-r--r--src/xhtml.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/xhtml.py b/src/xhtml.py
index cf7a5fc0..38ec690c 100644
--- a/src/xhtml.py
+++ b/src/xhtml.py
@@ -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