change hashbadge algorithm
parent
81a8770140
commit
015b6926b8
|
@ -21,6 +21,9 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const hueRange = 60;
|
||||
const hueCenter = 90 + bytes.length * 3;
|
||||
|
||||
let idx = 0;
|
||||
function draw() {
|
||||
const tmp = [];
|
||||
|
@ -31,10 +34,10 @@
|
|||
tmp.push(tmp[tmp.length - 1]);
|
||||
}
|
||||
|
||||
const r = (tmp[0]! / 128) * 255;
|
||||
const g = (tmp[1]! / 128) * 255;
|
||||
const b = (tmp[2]! / 128) * 255;
|
||||
ctx.fillStyle = `rgb(${r},${g},${b})`;
|
||||
const h = (tmp[0] / 128) * hueRange + hueCenter - hueRange / 2;
|
||||
const s = (tmp[1] / 128) * 100;
|
||||
const l = (tmp[2] / 128) * 100;
|
||||
ctx.fillStyle = `hsl(${h},${s}%,${l}%)`;
|
||||
ctx.fillRect(Math.floor(idx / BADGE_HEIGHT), idx % BADGE_HEIGHT, 1, 1);
|
||||
idx++;
|
||||
if (bytes.length > 0) {
|
||||
|
|
Loading…
Reference in New Issue