change hashbadge algorithm

feat/vaults
Tomáš Mládek 2021-12-21 22:31:37 +01:00
parent 81a8770140
commit 015b6926b8
No known key found for this signature in database
GPG Key ID: ED21612889E75EC5
1 changed files with 7 additions and 4 deletions

View File

@ -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) {