mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-28 10:10:20 +02:00
dcefcd19cb
Closes #895
12 lines
251 B
JavaScript
12 lines
251 B
JavaScript
"use strict";
|
|
|
|
// Generates a string from "color-1" to "color-32" based on an input string
|
|
module.exports = function(str) {
|
|
var hash = 0;
|
|
for (var i = 0; i < str.length; i++) {
|
|
hash += str.charCodeAt(i);
|
|
}
|
|
|
|
return "color-" + (1 + hash % 32);
|
|
};
|