Skip to main content
10 events
when toggle format what by license comment
Mar 21, 2019 at 19:51 comment added Cedric Arnould Don't forget to add '#' like return "#" + "00000".substring(0, 6 - c.length) + c;
Aug 24, 2017 at 1:43 comment added SirWojtek I have some problems with almost same colours for similar strings, for example: intToRGB(hashCode('hello1')) -> "3A019F" intToRGB(hashCode('hello2')) -> "3A01A0" And I enhance your code by adding multiplication for final hash value: return 100 * hash;
May 23, 2017 at 10:31 history edited URL Rewriter Bot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Jun 11, 2016 at 10:17 comment added Nimitz E. I wish I could convert this to php.
Feb 25, 2016 at 5:18 comment added Kyle Pennell I'm converting a bunch of music genre tags to background colors and this saved me a lot of time.
Jul 5, 2015 at 21:09 history edited Cristian Sanchez CC BY-SA 3.0
By popular demand, remove alpha and add padding.
Feb 6, 2014 at 22:38 comment added Thymine It needs to pad the hex strings, such as: ("00" + ((this >> 24) & 0xFF).toString(16)).slice(-2) + ("00" + ((this >> 16) & 0xFF).toString(16)).slice(-2) + ("00" + ((this >> 8) & 0xFF).toString(16)).slice(-2) + ("00" + (this & 0xFF).toString(16)).slice(-2);
May 29, 2013 at 0:22 review Suggested edits
May 29, 2013 at 0:24
Aug 8, 2010 at 23:25 vote accept Darragh Enright
Aug 6, 2010 at 19:11 history answered Cristian Sanchez CC BY-SA 2.5