improved color gen
This commit is contained in:
parent
c3d52fe242
commit
6ba5d6c233
1 changed files with 3 additions and 3 deletions
|
@ -119,14 +119,14 @@
|
||||||
function hashcode(s){
|
function hashcode(s){
|
||||||
return s.split("").reduce(
|
return s.split("").reduce(
|
||||||
function(acc,l){
|
function(acc,l){
|
||||||
acc = acc + (l.charCodeAt(0) - 'A'.charCodeAt(0));
|
acc = acc + 10 * (l.charCodeAt(0) - 'A'.charCodeAt(0));
|
||||||
return acc;
|
return (acc % 256);
|
||||||
},
|
},
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function genColor(devname) {
|
function genColor(devname) {
|
||||||
var h = 2.17*hashcode(devname) % 256;
|
var h = hashcode(devname);
|
||||||
return "hsl(" + h + ",80%, 36%)";
|
return "hsl(" + h + ",80%, 36%)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue