diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-10-29 01:30:19 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-10-29 01:30:19 +0800 |
| commit | 1298abd3377cc79d8883bb6e38b65bca46f0c8d7 (patch) | |
| tree | 5422ebd5fb2e4ccff0c6ce16834907521b62e467 /src/js/rbg.js | |
| parent | 4e0cde2e9e7cb2482b6d16dd2109c514fd98eeff (diff) | |
all space -> tab
Diffstat (limited to 'src/js/rbg.js')
| -rw-r--r-- | src/js/rbg.js | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/js/rbg.js b/src/js/rbg.js index 40f0dadd..fa6b11a6 100644 --- a/src/js/rbg.js +++ b/src/js/rbg.js @@ -1,38 +1,38 @@ document.body.style.transition = "background 1s ease-in-out"; function getRandomColor() { - const letters = "0123456789ABCDEF"; - let color = "#"; - for (let i = 0; i < 6; i++) { - color += letters[Math.floor(Math.random() * 16)]; - } - return color; +const letters = "0123456789ABCDEF"; +let color = "#"; +for (let i = 0; i < 6; i++) { + color += letters[Math.floor(Math.random() * 16)]; +} +return color; } function setRandomGradient() { - const rand3 = Math.floor(Math.random() * 3) + 1; - 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()}), +const rand3 = Math.floor(Math.random() * 3) + 1; +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()}), + 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()}), + Math.random() * 180 + )}deg, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}), linear-gradient(${Math.floor( - Math.random() * 180 - )}deg, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()})`; - } + Math.random() * 180 + )}deg, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()}, ${getRandomColor()})`; +} } setRandomGradient(); |
