Sometimes it generates bad color combination

Bug #893433 reported by Roy Tam
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
irclog2html
Opinion
Wishlist
Unassigned

Bug Description

Sometimes it generates bad color combination which is hard to read. Screenshot attached.

Revision history for this message
Roy Tam (roytam) wrote :
Revision history for this message
Marius Gedminas (mgedmin) wrote :

The text is either perfectly readable or not readable at all, depending on the angle I look at it on my laptop LCD screen.

irclog2html.py inherited the colour allocation algorithm from the original irclog2html Perl script by Jeff Waugh. Off the top of my head, I've no ideas how to tweak it to make the colours more readable.

If you have any suggestions (especially in patch form ;) ), I'm willing to listen.

Changed in irclog2html:
status: New → Opinion
importance: Undecided → Wishlist
Revision history for this message
Roy Tam (roytam) wrote :

I don't know if it is good for all people, but at least it is good for me:

diff -rU8 irclog2html-2.9.2-orig/src/irclog2html/irclog2html.py irclog2html-2.9.2/src/irclog2html/irclog2html.py
--- irclog2html-2.9.2-orig/src/irclog2html/irclog2html.py 2011-01-17 02:34:27.000000000 +0800
+++ irclog2html-2.9.2/src/irclog2html/irclog2html.py 2012-10-04 18:27:30.000000000 +0800
@@ -191,17 +191,17 @@

 #
 # Colouring stuff
 #

 class ColourChooser:
     """Choose distinguishable colours."""

- def __init__(self, rgbmin=240, rgbmax=125, rgb=None, a=0.95, b=0.5):
+ def __init__(self, rgbmin=235, rgbmax=115, rgb=None, a=0.95, b=0.44, c=0.64):
         """Define a range of colours available for choosing.

         `rgbmin` and `rgbmax` define the outmost range of colour depth (note
         that it is allowed to have rgbmin > rgbmax).

         `rgb`, if specified, is a list of (r,g,b) values where each component
         is between 0 and 1.0.

@@ -213,17 +213,19 @@
         """
         assert 0 <= rgbmin < 256
         assert 0 <= rgbmax < 256
         self.rgbmin = rgbmin
         self.rgbmax = rgbmax
         if not rgb:
             assert 0 <= a <= 1.0
             assert 0 <= b <= 1.0
- rgb = [(a,b,b), (b,a,b), (b,b,a), (a,a,b), (a,b,a), (b,a,a)]
+ assert 0 <= c <= 1.0
+ #rgb = [(a,b,b), (b,a,b), (b,b,a), (a,a,b), (a,b,a), (b,a,a)]
+ rgb = [(c, a, b), (a, b, b), (a, a, b), (c, b, c), (a, b, c), (b, b, a), (b, a, a), (a, c, a), (a, c, b), (b, b, c), (c, c, b), (c, c, a), (a, b, a), (c, b, a), (c, b, b), (a, c, c), (b, c, a), (b, a, c), (b, c, c), (c, a, a), (b, a, b), (c, a, c), (b, c, b), (a, a, c)]
         else:
             for r, g, b in rgb:
                 assert 0 <= r <= 1.0
                 assert 0 <= g <= 1.0
                 assert 0 <= b <= 1.0
         self.rgb = rgb

     def choose(self, i, n):
@@ -244,17 +246,17 @@
         assert 0 <= g < 256
         assert 0 <= b < 256
         return '#%02x%02x%02x' % (r, g, b)

 class NickColourizer:
     """Choose distinguishable colours for nicknames."""

- def __init__(self, maxnicks=30, colour_chooser=None, default_colours=None):
+ def __init__(self, maxnicks=70, colour_chooser=None, default_colours=None):
         """Create a colour chooser for nicknames.

         If you know how many different nicks there might be, specify that
         numer as `maxnicks`. If you don't know, don't worry.

         If you really want to, you can specify a colour chooser. Default is
         ColourChooser().

diff -rU8 irclog2html-2.9.2-orig/src/irclog2html/irclog.css irclog2html-2.9.2/src/irclog2html/irclog.css
--- irclog2html-2.9.2-orig/src/irclog2html/irclog.css 2010-08-23 17:58:36.000000000 +0800
+++ irclog2html-2.9.2/src/irclog2html/irclog.css 2012-10-04 17:49:08.000000000 +0800
@@ -14,20 +14,20 @@
     width: 100%;
 }
 th.nick {
     color: #ffffff;
     padding: 1px 2px;
 }
 td.text {
     width: 100%;
- background: #eeeeee;
+ background: #f3f3f3;
 }
 td.action {
- background: #eeeeee;
+ background: #f3f3f3;
 }

 /* Search box */

 div.searchbox {
     float: right;
     position: absolute;
     top: 1em;

Revision history for this message
Marius Gedminas (mgedmin) wrote :

Thank you for the patch (although I'd prefer if you put it in an attachment next time)!

A screenshot would make it easier for me to decide if I liked it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.