From b7666e1ca8bad2fb4bccfc8619fe99d000c2485f Mon Sep 17 00:00:00 2001 From: lolabird Date: Fri, 10 Nov 2023 08:26:39 -0700 Subject: [PATCH] Change rgb function name --- script.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index 01ff39e..78e4212 100644 --- a/script.js +++ b/script.js @@ -51,7 +51,9 @@ function getGridDimensions() { function colorGrid() { if (isRgb) { - this.style.background = rgbColor(); + this.style.background = randomizeColor(); + } else if (isTint) { + } else { this.style.background = colorValue; } @@ -66,6 +68,12 @@ function changeColor() { isRgb = false; } + if (buttonID === "tint") { + isTint = true; + } else { + isTint = false + } + switch (buttonID) { case "whiteColor": colorValue = "white"; @@ -88,7 +96,7 @@ function changeColor() { } } -function rgbColor() { +function randomizeColor() { let r = Math.floor(Math.random() * 255); let g = Math.floor(Math.random() * 255); let b = Math.floor(Math.random() * 255);