mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-02 05:42:20 +02:00
b3103e8c3f
These colors have been generated by the randomColor package
14 lines
285 B
JavaScript
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);
|
|
}
|
|
);
|