INNER CODE UNIT · TypeScript
hash
open-source-labs/Chronos · app/utils/index.ts:8
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
let colour = '#';
for (let i = 0; i < 3; i++) {
const value = (hash >> (i * 8)) & 0xff;
colour += `00${value.toString(16)}`.substring(-2);
}
// console.log(colour);
return colour;
}
};