thelounge/client/js/libs/handlebars/colorClass.js
Jérémie Astori b3103e8c3f Add light colors for dark themes Morning and Zenburn
These colors have been generated by the randomColor package
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-32" 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 % 32);
}
);