summaryrefslogtreecommitdiff
path: root/src/xhtml.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-11-07 19:55:16 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-11-08 00:15:41 +0100
commit24043586893ecfa599379c15fd7ae5fa531d2a14 (patch)
tree70bc4ac2481c21de7634e48cfb316296fb36c917 /src/xhtml.py
parentf271ef0620ab91573bfebb196ef5db54296bab4b (diff)
downloadpoezio-24043586893ecfa599379c15fd7ae5fa531d2a14.tar.gz
poezio-24043586893ecfa599379c15fd7ae5fa531d2a14.tar.bz2
poezio-24043586893ecfa599379c15fd7ae5fa531d2a14.tar.xz
poezio-24043586893ecfa599379c15fd7ae5fa531d2a14.zip
Fix the curses -> html color conversion
(cherry picked from commit 689f17cfd79b152d3ca75e570f9f13f70aa6c425)
Diffstat (limited to 'src/xhtml.py')
-rw-r--r--src/xhtml.py8
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):