diff options
author | Morgan Collett <morgan.collett@gmail.com> | 2008-05-26 11:20:49 (GMT) |
---|---|---|
committer | Morgan Collett <morgan.collett@gmail.com> | 2008-05-26 11:20:49 (GMT) |
commit | ecea73e913fe983f91d7617d35d1b8dfa4ce8af3 (patch) | |
tree | fff9bb7d08c9e7af962a940c1c90337ca4db25a2 /pippy_app.py | |
parent | dbf98b3eaaadc47905368ac8cb24f31f41adb1fc (diff) |
#5767: Use black text on light fill colors (matthias)
Diffstat (limited to 'pippy_app.py')
-rw-r--r-- | pippy_app.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/pippy_app.py b/pippy_app.py index c717de2..ad947c7 100644 --- a/pippy_app.py +++ b/pippy_app.py @@ -242,12 +242,19 @@ class Chat(ViewSourceActivity): nick = buddy.props.nick color = buddy.props.color try: - color_stroke, color_fill = color.split(',') + color_stroke_html, color_fill_html = color.split(',') except ValueError: - color_stroke, color_fill = ('#000000', '#888888') - color_stroke = Color(color_stroke).get_int() - color_fill = Color(color_fill).get_int() - text_color = COLOR_WHITE.get_int() + color_stroke_html, color_fill_html = ('#000000', '#888888') + # Select text color based on fill color: + color_fill_rgba = Color(color_fill_html).get_rgba() + color_fill_gray = (color_fill_rgba[0] + color_fill_rgba[1] + + color_fill_rgba[2])/3 + color_stroke = Color(color_stroke_html).get_int() + color_fill = Color(color_fill_html).get_int() + if color_fill_gray < 0.5: + text_color = COLOR_WHITE.get_int() + else: + text_color = COLOR_BLACK.get_int() else: nick = '???' # XXX: should be '' but leave for debugging color_stroke = COLOR_BLACK.get_int() @@ -571,6 +578,8 @@ CHAT_ICON=\ """ CHAT_NEWS=""" +#5767: Use black text on light fill colors (matthias) + 39 * ACK received messages (cassidy) |