Created
January 15, 2022 09:38
-
-
Save ThomasRettig/ffc87846da3b101f80608a36be4a01a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var body = document.getElementById("body") | |
var colors = ['#97F091', '#91f0e3', '#ffea54', '#e0f1ff', '#c8ffed', '#b0e8f5']; // the colors we'd like to use | |
body.style.backgroundColor = colours[Math.floor(Math.random() * colours.length)]; // randomly choose a color from the array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also, ensure that the
<body>
has theid="body"
attribute to it, in order forbackground-color
to be appended to it: