{"action":"created","issue":{"url":"https://api.github.com/repos/Fooidge/PleaseJS/issues/48","labels_url":"https://api.github.com/repos/Fooidge/PleaseJS/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/Fooidge/PleaseJS/issues/48/comments","events_url":"https://api.github.com/repos/Fooidge/PleaseJS/issues/48/events","html_url":"https://github.com/Fooidge/PleaseJS/issues/48","id":50016041,"number":48,"title":"Generate constant color for an object based on a key.","user":{"login":"s-panferov","id":198327,"avatar_url":"https://avatars.githubusercontent.com/u/198327?v=3","gravatar_id":"","url":"https://api.github.com/users/s-panferov","html_url":"https://github.com/s-panferov","followers_url":"https://api.github.com/users/s-panferov/followers","following_url":"https://api.github.com/users/s-panferov/following{/other_user}","gists_url":"https://api.github.com/users/s-panferov/gists{/gist_id}","starred_url":"https://api.github.com/users/s-panferov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s-panferov/subscriptions","organizations_url":"https://api.github.com/users/s-panferov/orgs","repos_url":"https://api.github.com/users/s-panferov/repos","events_url":"https://api.github.com/users/s-panferov/events{/privacy}","received_events_url":"https://api.github.com/users/s-panferov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-11-25T11:50:50Z","updated_at":"2015-03-14T13:24:52Z","closed_at":null,"body":"Hello! Thanks a lot for the amazing library!\r\n\r\nIn my project I need to create constant colors for users and chats based on their `id: Uuid`. I looked for a solution and found the PleaseJS library that is able to generate nice random colors. I have thought that I can override your random function to produce constant colors for any given `id`. But it was even easier! I just need to submit my `id` as `seed` and everything works! Cool! I use it this way:\r\n\r\n```typescript\r\nPlease.make_color({seed: id});\r\n```\r\n\r\nBut I still need to monkey-patch your library because there is no way to use my own `seed` value now. Maybe we should add it? This will enable such crazy use-cases as mine is. :heart_eyes: "},"comment":{"url":"https://api.github.com/repos/Fooidge/PleaseJS/issues/comments/80465629","html_url":"https://github.com/Fooidge/PleaseJS/issues/48#issuecomment-80465629","issue_url":"https://api.github.com/repos/Fooidge/PleaseJS/issues/48","id":80465629,"user":{"login":"tuckwat","id":59112,"avatar_url":"https://avatars.githubusercontent.com/u/59112?v=3","gravatar_id":"","url":"https://api.github.com/users/tuckwat","html_url":"https://github.com/tuckwat","followers_url":"https://api.github.com/users/tuckwat/followers","following_url":"https://api.github.com/users/tuckwat/following{/other_user}","gists_url":"https://api.github.com/users/tuckwat/gists{/gist_id}","starred_url":"https://api.github.com/users/tuckwat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuckwat/subscriptions","organizations_url":"https://api.github.com/users/tuckwat/orgs","repos_url":"https://api.github.com/users/tuckwat/repos","events_url":"https://api.github.com/users/tuckwat/events{/privacy}","received_events_url":"https://api.github.com/users/tuckwat/received_events","type":"User","site_admin":false},"created_at":"2015-03-14T13:24:52Z","updated_at":"2015-03-14T13:24:52Z","body":"I also am using the hue value to generate constant colors based on a String.  I'm using the hash function here: \r\nhttp://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\r\n\r\nand passing it into the hue property like so:\r\n\r\n```javascript\r\nvar colorSeed = Math.abs(hash) % 360;\r\nvar color = ColorUtil.make_color({golden: false,\r\n   hue: colorSeed,\r\n   saturation: 0.7,\r\n   value: 0.8\r\n});\r\n```\r\n\r\nSeems to be working well for my use case but only generates 360 unique colors.  Probably a good idea to use memoization if calling it frequently.  "}}