Commit 2ab7bf80 authored by Sander Kvenild's avatar Sander Kvenild
Browse files

Actually fixed the color generator this time

parent a1a95b4d
......@@ -178,13 +178,16 @@
}
function randomColor() {
let r = Math.floor(Math.random()*255).toString(16);
let g = Math.floor(Math.random()*255).toString(16);
let b = Math.floor(Math.random()*255).toString(16);
let color = Math.floor(Math.random()*16777215).toString(16)
console.log(color.length);
let color = `#${r}${g}${b}`.slice(0, 7);
return color;
// Test if color is has two digits for each of RGB respectively
while (color.length < 6) {
color = `0${color}`
console.log(color.length);
}
return `#${color}`;
}
function keypress(event) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment