2 ms·
This is great, thanks. A small fix I made to stop console warnings was to change: x.fillStyle = '#' + ((r >> 8) & 0xffffff).toString(16).padStart(0, 6); to:
by squiffy 5y ago
This is great, thanks. A small fix I made to stop console warnings was to change:
x.fillStyle = '#' + ((r >> 8) & 0xffffff).toString(16).padStart(0, 6);
to:
x.fillStyle = '#' + ((r >> 8) & 0xffffff).toString(16).padStart(6, '0');
as the pad target length is the first parameter of padStart.