I'm trying to make a web chart which displays various people in a different color based off of the person's name, that will be consistent for that name.
For example, if one of my resources was "Jane Doe", she might be calculated to have a navy blueish color, and "John Smith" could be some sort of light green.
The trick here is that I would need to make the color consistent for Jane and John wherever they showed up in the chart, but be noticeably different from every other name on the chart.
Sometimes this chart will only have a few people, and sometimes it will actually be pretty busy, so assigning color schemes based off of some finite set seems like a bad idea to me.
Additionally, I would need to make the foreground color contrast well with the background color, so that the chart was easy to read.
How can I do this in a webpage? I am envisioning two javascript functions: getBackColor(name) and getForeColor(name) but I'm not married to the idea if there's a better way to approach this.