[PATCH] hgweb: display branch names

Matt Mackall mpm at selenic.com
Thu Oct 23 18:48:27 UTC 2008


On Thu, 2008-10-23 at 19:51 +0200, Dirkjan Ochtman wrote:
> Benoît Allard wrote:
> > that patch adds the branch name to the webpage in the graph view and the 
> > changelog view for coal/paper and monoblue.
> 
> I've played with this more, but I'm not convinced there's enough 
> variation in the colors. On checking the mozilla-central repo, three 
> different branches turned out with similar shades of green. Could you 
> look into this some more? My current version of the patch is here:
> 
> http://hg.xavamedia.nl/mercurial/djc.mq/file/ca1bb3346510/branchnames#l1
> 

Here's a simple alternative: pick a number of colors N such that they're
not readily distinguishable (let's say 13), and pick N colors evenly
distributed around the color wheel. Then pick a number Q relatively
prime to N (say 5) and somewhere between N/3 and 2N/3 as the basic step
between colors. Give the first branch you encounter color 0, the next Q,
the next 2Q, until it wraps around:

>>> [(x * 5) % 13 for x in range(13)]
[0, 5, 10, 2, 7, 12, 4, 9, 1, 6, 11, 3, 8]

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list