Randomize rgb color

This commit is contained in:
lolabird 2023-11-09 23:17:42 -07:00
commit 34aa91359b

View file

@ -54,7 +54,7 @@ function changeColor() {
switch (buttonID) {
case "rgbColor":
colorValue = "red";
colorValue = rgbColor();
break;
case "whiteColor":
colorValue = "white";
@ -77,4 +77,14 @@ function changeColor() {
}
}
function rgbColor() {
let r = Math.floor(Math.random() * 255);
let g = Math.floor(Math.random() * 255);
let b = Math.floor(Math.random() * 255);
let rgbCol = "rgb(" + r + "," + g+ "," + b +")";
return rgbCol;
}
createGrid();