diff --git a/Source-Code/RandomColorGenerator/index.html b/Source-Code/RandomColorGenerator/index.html new file mode 100644 index 0000000..a5570f9 --- /dev/null +++ b/Source-Code/RandomColorGenerator/index.html @@ -0,0 +1,20 @@ + + + + + + Document + + + +
+
+

#fff

+ +
+
+ + + \ No newline at end of file diff --git a/Source-Code/RandomColorGenerator/script.js b/Source-Code/RandomColorGenerator/script.js new file mode 100644 index 0000000..1c853c8 --- /dev/null +++ b/Source-Code/RandomColorGenerator/script.js @@ -0,0 +1,17 @@ +const getColor = () => + { + const randomNumber=Math.floor(Math.random() * 1677215); + const randomCode = "#" + randomNumber.toString(16); + console.log(randomNumber,randomCode); + document.body.style.backgroundColor = randomCode + document.getElementById("color-code").innerText = randomCode + navigator.clipboard.writeText(randomCode)//Copy the color code to clipboard also + } + //function call + document.getElementById("btn").addEventListener( + "click", + getColor + ) + //init call + getColor(); + \ No newline at end of file diff --git a/Source-Code/RandomColorGenerator/style.css b/Source-Code/RandomColorGenerator/style.css new file mode 100644 index 0000000..fc3bdcf --- /dev/null +++ b/Source-Code/RandomColorGenerator/style.css @@ -0,0 +1,40 @@ +*{ + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: sans-serif; +} +body +{ + transition: 1s; +} +.main +{ + width: 100%; + height: 100vh; + display: flex; + justify-content: center; + align-items: center; +} +.container +{ + width: 30rem; + padding: 10px; + border-radius: 10px; + background-color: aliceblue; + font-size: 40px; + text-align: center; + + +} +button{ +display: block; +width: 100%; +background-color: black; +color: white; +border: none; +border-radius: 5px; + font-size: 40px; + margin-top: 5px; + +} \ No newline at end of file