From: Max Williams Date: 2009-04-14T18:26:36+09:00 Subject: A challenge: generate web colors for tree nodes. hey all here's a nice little ruby challenge to welcome everyone back after easter: I have a long (about 1100) list of elements (class name Property), arranged into a tree structure. I want each node to have its own unique color, as a web color format string (eg "#112233"). Each has an id, a parent_id and a name - the color can be generated using any or all of these, or by some other (consistent) method. Further requirements: The color can't be brighter than #aaaaaa. Properties with the same parent_id should have distinctly different colors. The color can be essentially random, but should be consistent - ie if it's generated using the name then it should only ever change if the name changes. I've got a few vague ideas involving SHA1 but i thought i'd throw this out as a fun ruby task :) Hopefully i'll post my own idea soon. cheers max -- Posted via http://www.ruby-forum.com/.