improved color gen

This commit is contained in:
Yann Esposito (Yogsototh) 2021-09-06 15:39:07 +02:00
parent c3d52fe242
commit 6ba5d6c233
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646

View file

@ -119,14 +119,14 @@
function hashcode(s){
return s.split("").reduce(
function(acc,l){
acc = acc + (l.charCodeAt(0) - 'A'.charCodeAt(0));
return acc;
acc = acc + 10 * (l.charCodeAt(0) - 'A'.charCodeAt(0));
return (acc % 256);
},
0);
}
function genColor(devname) {
var h = 2.17*hashcode(devname) % 256;
var h = hashcode(devname);
return "hsl(" + h + ",80%, 36%)";
}