diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-11-07 19:55:16 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-11-07 19:55:16 +0100 |
commit | 689f17cfd79b152d3ca75e570f9f13f70aa6c425 (patch) | |
tree | 13d28570a656652c2861d646fbb7e1fe27999554 | |
parent | 36cd91dc9c6e30025e622f958fbdf984de10483b (diff) | |
download | poezio-689f17cfd79b152d3ca75e570f9f13f70aa6c425.tar.gz poezio-689f17cfd79b152d3ca75e570f9f13f70aa6c425.tar.bz2 poezio-689f17cfd79b152d3ca75e570f9f13f70aa6c425.tar.xz poezio-689f17cfd79b152d3ca75e570f9f13f70aa6c425.zip |
Fix the curses -> html color conversion
-rw-r--r-- | src/xhtml.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/xhtml.py b/src/xhtml.py index 2cedba7d..748c9080 100644 --- a/src/xhtml.py +++ b/src/xhtml.py @@ -201,9 +201,9 @@ def ncurses_color_to_html(color): """ if color <= 15: (r, g, b) = curses.color_content(color) - r = r / 1000 * 6 - g = g / 1000 * 6 - b = b / 1000 * 6 + r = r / 1000 * 6 - 0.01 + g = g / 1000 * 6 - 0.01 + b = b / 1000 * 6 - 0.01 elif color <= 231: color = color - 16 r = color % 6 @@ -214,7 +214,7 @@ def ncurses_color_to_html(color): else: color -= 232 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 parse_css(css): |