0

In my application I have a chat service.

And as with chat, there are many users with different nicks, and I would like to have each nick with different color. So, are there any javascript algorithms which can convert a string (nick) to a RGB value? I was thinking about, idk, getting ascii value of each character, adding them together, and then somehow converting it to three hex values? Or something similar? Does anyone have any ideas on how to approach it?

ojek
  • 9,680
  • 21
  • 71
  • 110
  • 2
    _"I was thinking about, idk, getting ascii value of each character..."_ - So why don't you try that? – nnnnnn Dec 05 '13 at 20:41
  • @nnnnnn: Because maybe someone already implemented something similar, and is willing to share his solution with me? – ojek Dec 05 '13 at 20:42
  • 1
    Looks like a [number](https://www.google.com/search?q=generate+RGB+based+on+string) of [other](http://stackoverflow.com/questions/3426404/create-a-hexadecimal-colour-based-on-a-string-with-jquery-javascript) [people](http://stackoverflow.com/questions/2464745/compute-hex-color-code-for-an-arbitrary-string) have done exactly what you describe. Try something out, like @nnnnnn said, or do some research you oldbie (said as lovingly as possible)!! – admdrew Dec 05 '13 at 20:43
  • @admdrew: Yeah, there are some solutions there, thanks! – ojek Dec 05 '13 at 20:46

0 Answers0