[Pidgin] #4534: Nickname colors in chat windows hard to read

Pidgin trac at pidgin.im
Sat Mar 22 10:00:44 EDT 2008


#4534: Nickname colors in chat windows hard to read
---------------------------+------------------------------------------------
  Reporter:  kaedenn       |       Owner:  lschiere
      Type:  defect        |      Status:  new     
  Priority:  minor         |   Milestone:          
 Component:  unclassified  |     Version:  2.3.1   
Resolution:                |    Keywords:          
   Pending:  0             |  
---------------------------+------------------------------------------------
Comment (by lobais):

 The code does avoid already existing colors. If you have 10 people in the
 room, and the eleventh appear, you get your color by genColor(11).

 It doesn't guarantee not to clash with the background color, but it lies
 in the tango saturation, and works good on white as wall as black
 backgrounds.

 {{{
 def genColor (n, startpoint=0):
     assert n >= 1
     # This splits the 0 - 1 segment in the pizza way
     h = (2*n-1)/(2**ceil(log(n)/log(2)))-1
     h = (h + startpoint) % 1
     # We set saturation based on the amount of green, in the range 0.6 to
 0.8
     rgb = colorsys.hsv_to_rgb(h, 1, 1)
     rgb = colorsys.hsv_to_rgb(h, 1, (1-rgb[1])*0.2+0.6)
     return rgb
 }}}

-- 
Ticket URL: <http://developer.pidgin.im/ticket/4534#comment:4>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list