thelounge/client/js/libs/handlebars/colorClass.js
Pavel Djundik a3e448acf5 Enable no-var rule
Fixes #1961
2018-02-19 19:49:39 +02:00

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) {
let hash = 0;
for (let i = 0; i < str.length; i++) {
hash += str.charCodeAt(i);
}
return "color-" + (1 + hash % 32);
};