thelounge/client/js/libs/handlebars/colorClass.js
Jérémie Astori c87d82dc48 Replace color generation with CSS classes
These colors were built using the current generation function to have
similar style.
2016-05-15 15:21:18 -04:00

14 lines
285 B
JavaScript

"use strict";
Handlebars.registerHelper(
// Generates a string from "color-1" to "color-64" based on an input string
"colorClass", function(str) {
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash += str.charCodeAt(i);
}
return "color-" + (1 + hash % 64);
}
);