summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-11 22:58:35 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-11 22:59:19 +0800
commitbb4a0fec79187ae768b1a23ad50887d736edb9ba (patch)
treeb4a537441db3fde3a3a0f1fbc308be886ec8d6f1
parentfb16a87d85d711a990acf7b522850822c40b8304 (diff)
more colors(3)
-rw-r--r--src/js/rbg.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/js/rbg.js b/src/js/rbg.js
index e67a0063..0b1cec5f 100644
--- a/src/js/rbg.js
+++ b/src/js/rbg.js
@@ -8,7 +8,17 @@ function getRandomColor() {
}
function setRandomGradient() {
- document.body.style.background = `linear-gradient(${Math.floor(Math.random() * 180)}deg, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()})`;
+ const rand3 = Math.floor(Math.random());
+ if (rand3 === 1) {
+ document.body.style.background = `linear-gradient(${Math.floor(Math.random() * 180)}deg, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()})`;
+ } else if (rand3 === 2) {
+ document.body.style.background = `linear-gradient(${Math.floor(Math.random() * 180)}deg, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}),
+linear-gradient(${Math.floor(Math.random() * 180)}deg, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()})`;
+ } else {
+ document.body.style.background = `linear-gradient(${Math.floor(Math.random() * 180)}deg, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}),
+linear-gradient(${Math.floor(Math.random() * 180)}deg, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}),
+linear-gradient(${Math.floor(Math.random() * 180)}deg, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()})`;
+ }
}
setRandomGradient();