Change rgb function name
This commit is contained in:
parent
fbe4096bae
commit
b7666e1ca8
1 changed files with 10 additions and 2 deletions
12
script.js
12
script.js
|
|
@ -51,7 +51,9 @@ function getGridDimensions() {
|
||||||
|
|
||||||
function colorGrid() {
|
function colorGrid() {
|
||||||
if (isRgb) {
|
if (isRgb) {
|
||||||
this.style.background = rgbColor();
|
this.style.background = randomizeColor();
|
||||||
|
} else if (isTint) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.style.background = colorValue;
|
this.style.background = colorValue;
|
||||||
}
|
}
|
||||||
|
|
@ -66,6 +68,12 @@ function changeColor() {
|
||||||
isRgb = false;
|
isRgb = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (buttonID === "tint") {
|
||||||
|
isTint = true;
|
||||||
|
} else {
|
||||||
|
isTint = false
|
||||||
|
}
|
||||||
|
|
||||||
switch (buttonID) {
|
switch (buttonID) {
|
||||||
case "whiteColor":
|
case "whiteColor":
|
||||||
colorValue = "white";
|
colorValue = "white";
|
||||||
|
|
@ -88,7 +96,7 @@ function changeColor() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function rgbColor() {
|
function randomizeColor() {
|
||||||
let r = Math.floor(Math.random() * 255);
|
let r = Math.floor(Math.random() * 255);
|
||||||
let g = Math.floor(Math.random() * 255);
|
let g = Math.floor(Math.random() * 255);
|
||||||
let b = Math.floor(Math.random() * 255);
|
let b = Math.floor(Math.random() * 255);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue