Fix the curses -> html color conversion

This commit is contained in:
Florent Le Coz 2011-11-07 19:55:16 +01:00
parent 36cd91dc9c
commit 689f17cfd7

View file

@ -201,9 +201,9 @@ def ncurses_color_to_html(color):
""" """
if color <= 15: if color <= 15:
(r, g, b) = curses.color_content(color) (r, g, b) = curses.color_content(color)
r = r / 1000 * 6 r = r / 1000 * 6 - 0.01
g = g / 1000 * 6 g = g / 1000 * 6 - 0.01
b = b / 1000 * 6 b = b / 1000 * 6 - 0.01
elif color <= 231: elif color <= 231:
color = color - 16 color = color - 16
r = color % 6 r = color % 6
@ -214,7 +214,7 @@ def ncurses_color_to_html(color):
else: else:
color -= 232 color -= 232
r = g = b = color / 24 * 6 r = g = b = color / 24 * 6
return '#%X%X%X' % (r*256/6, g*256/6, b*256/6) return '#%02X%02X%02X' % (r*256/6, g*256/6, b*256/6)
def xhtml_to_poezio_colors(text): def xhtml_to_poezio_colors(text):
def parse_css(css): def parse_css(css):