From ecea73e913fe983f91d7617d35d1b8dfa4ce8af3 Mon Sep 17 00:00:00 2001 From: Morgan Collett Date: Mon, 26 May 2008 11:20:49 +0000 Subject: #5767: Use black text on light fill colors (matthias) --- (limited to 'pippy_app.py') 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) -- cgit v0.9.1