[Pidgin] #4534: Nickname colors in chat windows hard to read
Pidgin
trac at pidgin.im
Sun Mar 9 16:54:03 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):
I've made this python algorithm for generating colors.
If you want 10 colors, you call it with genColor(1), genColor(2),
genColor(3)...
Then it will genereate 10 colors which looks good, and lies as far from
each other on the colors circle as possible.
It will always start at the same place on the colorcircle, so if you don't
want all chats to start with a person in red, you can generate a random
seed 0-1 and give to all genColor calls in that chat.
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:1>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list