Skip to content

Instantly share code, notes, and snippets.

@CS1000
CS1000 / colornames.js
Last active Aug 29, 2015 — forked from rlemon/colornames.js
For use on Miaou (add "color: <#hexcolor || colorname>" somewhere in your profile->about me)
View colornames.js
function hashCode(str) {
var hash = 0;
str += '!';
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
return -hash;
}
function colorCode(i) {
return '#' + (Math.min((i >> 24) & 0xFF, 200).toString(16) +